diff Python/symtable.c @ 79009:99ab7006e466 3.2

Cleanup 'k' when the creation of PySTEntryObject fails. ad3824a90261 used to decref 'k' in too many error cases.
author Christian Heimes <christian@cheimes.de>
date Wed, 12 Sep 2012 17:58:10 +0200
parents 2888356cdd4e
children 5b64fefbc16b
line wrap: on
line diff
--- a/Python/symtable.c	Wed Sep 12 17:52:46 2012 +0200
+++ b/Python/symtable.c	Wed Sep 12 17:58:10 2012 +0200
@@ -34,8 +34,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 */