diff Python/symtable.c @ 79011:128fa8755e55 2.7

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 f19b84915c17
children
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
@@ -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 */