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


http://hg.python.org/cpython/rev/ad3824a90261
changeset:   78943:ad3824a90261
branch:      3.2
parent:      78940:9f4e6c0c18e6
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
@@ -28,7 +28,7 @@
         void *key, int lineno, int col_offset)
 {
     PySTEntryObject *ste = NULL;
-    PyObject *k;
+    PyObject *k = NULL;
 
     k = PyLong_FromVoidPtr(key);
     if (k == NULL)
@@ -83,6 +83,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