[Python-checkins] cpython (merge 3.2 -> default): 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:57 CEST 2012


http://hg.python.org/cpython/rev/a29854168241
changeset:   78945:a29854168241
parent:      78941:517aa5576ae3
parent:      78943:ad3824a90261
user:        Christian Heimes <christian at cheimes.de>
date:        Mon Sep 10 03:09:17 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
@@ -24,7 +24,7 @@
         void *key, int lineno, int col_offset)
 {
     PySTEntryObject *ste = NULL;
-    PyObject *k;
+    PyObject *k = NULL;
 
     k = PyLong_FromVoidPtr(key);
     if (k == NULL)
@@ -79,6 +79,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