[Python-checkins] cpython (3.5): ssue #27942: Fix memory leak in codeobject.c

yury.selivanov python-checkins at python.org
Wed Nov 9 09:43:43 EST 2016


https://hg.python.org/cpython/rev/2c6825c9ecfd
changeset:   105010:2c6825c9ecfd
branch:      3.5
parent:      105006:952d8dfc0229
user:        Yury Selivanov <yury at magic.io>
date:        Wed Nov 09 09:42:14 2016 -0500
summary:
  ssue #27942: Fix memory leak in codeobject.c

files:
  Misc/NEWS            |  2 ++
  Objects/codeobject.c |  2 ++
  2 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -110,6 +110,8 @@
 - 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
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -69,6 +69,7 @@
             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 @@
                 }
                 else {
                     PyTuple_SET_ITEM(tuple, i, v);
+                    Py_DECREF(w);
                     modified = 1;
                 }
             }

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list