[Python-checkins] cpython (2.7): Closed reference leak of variable 'k' in function ste_new which wasn't decrefed

christian.heimes python-checkins at python.org
Mon Sep 10 03:09:56 CEST 2012


http://hg.python.org/cpython/rev/61446e56f683
changeset:   78944:61446e56f683
branch:      2.7
parent:      78942:2b611280ff36
user:        Christian Heimes <christian at cheimes.de>
date:        Mon Sep 10 03:08:46 2012 +0200
summary:
  Closed reference leak of variable 'k' in function ste_new which wasn't decrefed in error cases

files:
  Python/symtable.c |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Python/symtable.c b/Python/symtable.c
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -22,7 +22,7 @@
               void *key, int lineno)
 {
     PySTEntryObject *ste = NULL;
-    PyObject *k;
+    PyObject *k = NULL;
 
     k = PyLong_FromVoidPtr(key);
     if (k == NULL)
@@ -75,6 +75,7 @@
 
     return ste;
  fail:
+    Py_XDECREF(k);
     Py_XDECREF(ste);
     return NULL;
 }

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


More information about the Python-checkins mailing list