[Python-checkins] cpython (3.2): Issue #13020: Fix a reference leak when allocating a structsequence object

antoine.pitrou python-checkins at python.org
Wed Feb 15 03:00:52 CET 2012


http://hg.python.org/cpython/rev/6454e5de7c34
changeset:   74939:6454e5de7c34
branch:      3.2
parent:      74936:86adb5c7a9d4
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Wed Feb 15 02:51:43 2012 +0100
summary:
  Issue #13020: Fix a reference leak when allocating a structsequence object fails.
Patch by Suman Saha.

files:
  Misc/NEWS           |  3 +++
  Objects/structseq.c |  1 +
  2 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@
 Core and Builtins
 -----------------
 
+- Issue #13020: Fix a reference leak when allocating a structsequence object
+  fails.  Patch by Suman Saha.
+
 - Issue #13908: Ready types returned from PyType_FromSpec.
 
 - Issue #11235: Fix OverflowError when trying to import a source file whose
diff --git a/Objects/structseq.c b/Objects/structseq.c
--- a/Objects/structseq.c
+++ b/Objects/structseq.c
@@ -129,6 +129,7 @@
 
     res = (PyStructSequence*) PyStructSequence_New(type);
     if (res == NULL) {
+        Py_DECREF(arg);
         return NULL;
     }
     for (i = 0; i < len; ++i) {

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list