Cleanup 'k' when the creation of PySTEntryObject fails. ad3824a90261 used to decref 'k' in too many error cases.

This commit is contained in:
Christian Heimes 2012-09-12 17:58:20 +02:00
commit 10ca1fee8f
1 changed files with 3 additions and 1 deletions

View File

@ -30,8 +30,10 @@ ste_new(struct symtable *st, identifier name, _Py_block_ty block,
if (k == NULL) if (k == NULL)
goto fail; goto fail;
ste = PyObject_New(PySTEntryObject, &PySTEntry_Type); ste = PyObject_New(PySTEntryObject, &PySTEntry_Type);
if (ste == NULL) if (ste == NULL) {
Py_DECREF(k);
goto fail; goto fail;
}
ste->ste_table = st; ste->ste_table = st;
ste->ste_id = k; /* ste owns reference to k */ ste->ste_id = k; /* ste owns reference to k */