Skip to content

Commit 9a7f8df

Browse files
committed
Issue #13020: Fix a reference leak when allocating a structsequence object fails.
Patch by Suman Saha.
1 parent 2e19e8e commit 9a7f8df

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ What's New in Python 2.7.3?
99
Core and Builtins
1010
-----------------
1111

12+
- Issue #13020: Fix a reference leak when allocating a structsequence object
13+
fails. Patch by Suman Saha.
14+
1215
- Issue #11235: Fix OverflowError when trying to import a source file whose
1316
modification time doesn't fit in a 32-bit timestamp.
1417

Objects/structseq.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ structseq_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
201201

202202
res = (PyStructSequence*) PyStructSequence_New(type);
203203
if (res == NULL) {
204+
Py_DECREF(arg);
204205
return NULL;
205206
}
206207
for (i = 0; i < len; ++i) {

0 commit comments

Comments
 (0)