From d2fd3599abeed393ccdf4ee5cf1c7b346ba4a022 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Wed, 9 Nov 2016 09:42:14 -0500 Subject: ssue #27942: Fix memory leak in codeobject.c --- Misc/NEWS | 2 ++ Objects/codeobject.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Misc/NEWS b/Misc/NEWS index 7512e1a..10ec9e0 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 9df87b0..c334626 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; } } -- cgit v0.12