]> granicus.if.org Git - python/commitdiff
Issue #27942: Fix memory leak in codeobject.c
authorYury Selivanov <yury@magic.io>
Wed, 9 Nov 2016 14:41:15 +0000 (09:41 -0500)
committerYury Selivanov <yury@magic.io>
Wed, 9 Nov 2016 14:41:15 +0000 (09:41 -0500)
Objects/codeobject.c

index 79ac1b5340fbf338039fda7b16b43ad50bded205..a66aa6905a927555dfd11323c711551bc79c94de 100644 (file)
@@ -65,6 +65,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();
@@ -77,6 +78,7 @@ intern_string_constants(PyObject *tuple)
                 }
                 else {
                     PyTuple_SET_ITEM(tuple, i, v);
+                    Py_DECREF(w);
                     modified = 1;
                 }
             }