]> granicus.if.org Git - python/commitdiff
Issue #13020: Fix a reference leak when allocating a structsequence object fails.
authorAntoine Pitrou <solipsis@pitrou.net>
Wed, 15 Feb 2012 01:51:43 +0000 (02:51 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Wed, 15 Feb 2012 01:51:43 +0000 (02:51 +0100)
Patch by Suman Saha.

Misc/NEWS
Objects/structseq.c

index 0bfbd3861ab2abc9ec87e2e75841460de004dd57..ba09480640a59ad9c5bb4879c1906d8442d791bf 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -9,6 +9,9 @@ What's New in Python 2.7.3?
 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.
 
index 58e15cb8620bd593606bebaf606a6d26fc1db4b2..dcc5457a2d5e54dfaf5cb7879c014ffb5503f310 100644 (file)
@@ -201,6 +201,7 @@ structseq_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 
     res = (PyStructSequence*) PyStructSequence_New(type);
     if (res == NULL) {
+        Py_DECREF(arg);
         return NULL;
     }
     for (i = 0; i < len; ++i) {