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 0ef337c56bd3e732edff2e2ae269c5b01d875b6b..4d3d665e54d43e1db7d51124341dce0914ac9b35 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ What's New in Python 3.2.3?
 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
index ef17f49a31400eac6af35a7539c528510005cc0e..ac4f980a0697f66070ed9fddb1e8ecf4ff1b30fe 100644 (file)
@@ -129,6 +129,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) {