[Python-checkins] cpython (2.7): Issue #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/41613bb27f80
changeset:   105009:41613bb27f80
branch:      2.7
parent:      104976:e0cc3fadd7b3
user:        Yury Selivanov <yury at magic.io>
date:        Wed Nov 09 09:41:15 2016 -0500
summary:
  Issue #27942: Fix memory leak in codeobject.c

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


diff --git a/Objects/codeobject.c b/Objects/codeobject.c
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -65,6 +65,7 @@
             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 @@
                 }
                 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