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

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


http://hg.python.org/cpython/rev/08a85fc85bf2
changeset:   74943:08a85fc85bf2
branch:      2.7
parent:      74938:7611fb3e19c6
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
@@ -9,6 +9,9 @@
 Core and Builtins
 -----------------
 
+- Issue #13020: Fix a reference leak when allocating a structsequence object
+  fails.  Patch by Suman Saha.
+
 - Issue #11235: Fix OverflowError when trying to import a source file whose
   modification time doesn't fit in a 32-bit timestamp.
 
diff --git a/Objects/structseq.c b/Objects/structseq.c
--- a/Objects/structseq.c
+++ b/Objects/structseq.c
@@ -201,6 +201,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