Issue 13020: structseq.c: refleak - Python tracker (original) (raw)

Created on 2011-09-20 14:57 by Suman.Saha, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python_patch8 Suman.Saha,2011-09-20 14:57 Patch review
Messages (6)
msg144337 - (view) Author: Suman Saha (Suman.Saha) Date: 2011-09-20 14:57
Something that is allocated using PySequence_Fast is not freed on one error path.
msg144339 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2011-09-20 15:09
Hi, thanks for the report(s) and the patch(es)! I think it would be better to have a test that shows the refleak for each of the patches that you submitted. Just out of curiosity, how did you find these?
msg144398 - (view) Author: Meador Inge (meador.inge) * (Python committer) Date: 2011-09-22 02:52
In general I agree that a test case is needed, but in this particular case its looks to be non-trivial to come up with one. The only way the reference leak is triggered is when memory is exhausted during an attempt to new up a 'PyStructSequence' object.
msg151656 - (view) Author: Torsten Landschoff (torsten) * Date: 2012-01-19 21:52
+1 for the patch. All the error paths above the change do Py_DECREF(arg); return NULL; arg is initialized with PySequence_Fast, which returns a new reference. Hard to create a test case for this...
msg153387 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-02-15 02:00
New changeset 6454e5de7c34 by Antoine Pitrou in branch '3.2': Issue #13020: Fix a reference leak when allocating a structsequence object fails. http://hg.python.org/cpython/rev/6454e5de7c34 New changeset 5e0085d67f65 by Antoine Pitrou in branch 'default': Issue #13020: Fix a reference leak when allocating a structsequence object fails. http://hg.python.org/cpython/rev/5e0085d67f65 New changeset 08a85fc85bf2 by Antoine Pitrou in branch '2.7': Issue #13020: Fix a reference leak when allocating a structsequence object fails. http://hg.python.org/cpython/rev/08a85fc85bf2
msg153388 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-02-15 02:01
I've now committed the patch. Thanks for contributing!
History
Date User Action Args
2022-04-11 14:57:21 admin set github: 57229
2012-02-15 02:01:29 pitrou set status: open -> closedversions: + Python 2.7, Python 3.2, Python 3.3nosy: + pitroumessages: + resolution: fixedstage: test needed -> resolved
2012-02-15 02:00:55 python-dev set nosy: + python-devmessages: +
2012-01-19 21:52:33 torsten set nosy: + torstenmessages: +
2011-09-22 02:52:35 meador.inge set nosy: + meador.ingemessages: +
2011-09-21 19:23:21 skrah set title: Resource is not released before returning from the functiion -> structseq.c: refleak
2011-09-20 15:09:54 ezio.melotti set nosy: + ezio.melottimessages: + stage: test needed
2011-09-20 14:57:35 Suman.Saha create