From: Antoine Pitrou Date: Wed, 15 Feb 2012 01:51:43 +0000 (+0100) Subject: Issue #13020: Fix a reference leak when allocating a structsequence object fails. X-Git-Tag: v3.2.3rc1~62 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=37784ba5c08aed9a3153eb5a37014e59ee3769fe;p=thirdparty%2FPython%2Fcpython.git Issue #13020: Fix a reference leak when allocating a structsequence object fails. Patch by Suman Saha. --- diff --git a/Misc/NEWS b/Misc/NEWS index 0ef337c56bd3..4d3d665e54d4 100644 --- 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 diff --git a/Objects/structseq.c b/Objects/structseq.c index ef17f49a3140..ac4f980a0697 100644 --- a/Objects/structseq.c +++ b/Objects/structseq.c @@ -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) {