[Python-checkins] cpython (2.7): Cleanup 'k' when the creation of PySTEntryObject fails. ad3824a90261 used to

christian.heimes python-checkins at python.org
Wed Sep 12 17:59:12 CEST 2012


http://hg.python.org/cpython/rev/128fa8755e55
changeset:   79011:128fa8755e55
branch:      2.7
parent:      79008:f19b84915c17
user:        Christian Heimes <christian at cheimes.de>
date:        Wed Sep 12 17:58:10 2012 +0200
summary:
  Cleanup 'k' when the creation of PySTEntryObject fails. ad3824a90261 used to decref 'k' in too many error cases.

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


diff --git a/Python/symtable.c b/Python/symtable.c
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -28,8 +28,10 @@
     if (k == NULL)
         goto fail;
     ste = PyObject_New(PySTEntryObject, &PySTEntry_Type);
-    if (ste == NULL)
+    if (ste == NULL) {
+        Py_DECREF(k);
         goto fail;
+    }
     ste->ste_table = st;
     ste->ste_id = k; /* ste owns reference to k */
 

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


More information about the Python-checkins mailing list