From: Yury Selivanov Date: Wed, 9 Nov 2016 14:42:14 +0000 (-0500) Subject: ssue #27942: Fix memory leak in codeobject.c X-Git-Tag: v3.6.0b4~115^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d2fd3599abeed393ccdf4ee5cf1c7b346ba4a022;p=thirdparty%2FPython%2Fcpython.git ssue #27942: Fix memory leak in codeobject.c --- diff --git a/Misc/NEWS b/Misc/NEWS index 7512e1a4d802..10ec9e0b3898 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -110,6 +110,8 @@ Core and Builtins - Issue #27443: __length_hint__() of bytearray iterators no longer return a negative integer for a resized bytearray. +- Issue #27942: Fix memory leak in codeobject.c + Library ------- diff --git a/Objects/codeobject.c b/Objects/codeobject.c index 9df87b04f851..c33462651761 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -69,6 +69,7 @@ intern_string_constants(PyObject *tuple) intern_string_constants(v); } else if (PyFrozenSet_CheckExact(v)) { + PyObject *w = v; PyObject *tmp = PySequence_Tuple(v); if (tmp == NULL) { PyErr_Clear(); @@ -81,6 +82,7 @@ intern_string_constants(PyObject *tuple) } else { PyTuple_SET_ITEM(tuple, i, v); + Py_DECREF(w); modified = 1; } }