Skip to content

Commit ebbf4a9

Browse files
committed
Cleanup 'k' when the creation of PySTEntryObject fails. ad3824a90261 used to decref 'k' in too many error cases.
1 parent 88d0998 commit ebbf4a9

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
@@ -28,8 +28,10 @@ ste_new(struct symtable *st, identifier name, _Py_block_ty block,
2828
if (k == NULL)
2929
goto fail;
3030
ste = PyObject_New(PySTEntryObject, &PySTEntry_Type);
31-
if (ste == NULL)
31+
if (ste == NULL) {
32+
Py_DECREF(k);
3233
goto fail;
34+
}
3335
ste->ste_table = st;
3436
ste->ste_id = k; /* ste owns reference to k */
3537

0 commit comments

Comments
 (0)