]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
ssue #27942: Fix memory leak in codeobject.c
authorYury Selivanov <yury@magic.io>
Wed, 9 Nov 2016 14:42:14 +0000 (09:42 -0500)
committerYury Selivanov <yury@magic.io>
Wed, 9 Nov 2016 14:42:14 +0000 (09:42 -0500)
Misc/NEWS
Objects/codeobject.c

index 7512e1a4d802c5bfb66eb001032197cbba7a2157..10ec9e0b3898f121740fb175503dda7b0941abcb 100644 (file)
--- 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
 -------
 
index 9df87b04f8510dd4bb84ca330d44c3d42daf8c86..c334626517613fe44ae6f8dcfadae93c17afd83d 100644 (file)
@@ -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;
                 }
             }