Skip to content

Commit 10ca1fe

Browse files
committed
Cleanup 'k' when the creation of PySTEntryObject fails. ad3824a90261 used to decref 'k' in too many error cases.
2 parents 9c5b521 + 55ad651 commit 10ca1fe

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Python/symtable.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ ste_new(struct symtable *st, identifier name, _Py_block_ty block,
3030
if (k == NULL)
3131
goto fail;
3232
ste = PyObject_New(PySTEntryObject, &PySTEntry_Type);
33-
if (ste == NULL)
33+
if (ste == NULL) {
34+
Py_DECREF(k);
3435
goto fail;
36+
}
3537
ste->ste_table = st;
3638
ste->ste_id = k; /* ste owns reference to k */
3739

0 commit comments

Comments
 (0)