summaryrefslogtreecommitdiffstats
path: root/Python/symtable.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2012-09-12 15:58:20 (GMT)
committerChristian Heimes <christian@cheimes.de>2012-09-12 15:58:20 (GMT)
commit10ca1fee8f293af317cbcca0f38b15a300036b7b (patch)
tree53a95e36bbc16c3596665c45f16e0e3eb9552340 /Python/symtable.c
parent9c5b521c715d7f369413d054b68edbca8eef41e4 (diff)
parent55ad6515c90148bbcaeee0d7a185bfecc9aa1693 (diff)
downloadcpython-10ca1fee8f293af317cbcca0f38b15a300036b7b.zip
cpython-10ca1fee8f293af317cbcca0f38b15a300036b7b.tar.gz
cpython-10ca1fee8f293af317cbcca0f38b15a300036b7b.tar.bz2
Cleanup 'k' when the creation of PySTEntryObject fails. ad3824a90261 used to decref 'k' in too many error cases.
Diffstat (limited to 'Python/symtable.c')
-rw-r--r--Python/symtable.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/symtable.c b/Python/symtable.c
index 36f59ae..1c291bb 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -30,8 +30,10 @@ ste_new(struct symtable *st, identifier name, _Py_block_ty block,
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 */