summaryrefslogtreecommitdiff
path: root/Python/symtable.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2012-09-12 17:58:10 +0200
committerChristian Heimes <christian@cheimes.de>2012-09-12 17:58:10 +0200
commit55ad6515c90148bbcaeee0d7a185bfecc9aa1693 (patch)
treeb7a935b80bda06b0d0513c16bcac761d43cbfc3a /Python/symtable.c
parent1526582df686a66e15c1944aed13c2ea6b922882 (diff)
downloadcpython-git-55ad6515c90148bbcaeee0d7a185bfecc9aa1693.tar.gz
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 992b5aeb58..35fc6e1954 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -34,8 +34,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 */