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: v2.7.3rc1~59 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c66ed457ef5318c56bf5109d0a4be30c6ccee866;p=python 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 0bfbd3861a..ba09480640 100644 --- 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. diff --git a/Objects/structseq.c b/Objects/structseq.c index 58e15cb862..dcc5457a2d 100644 --- a/Objects/structseq.c +++ b/Objects/structseq.c @@ -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) {