Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 55ad651

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

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
@@ -34,8 +34,10 @@ ste_new(struct symtable *st, identifier name, _Py_block_ty block,
3434
if (k == NULL)
3535
goto fail;
3636
ste = PyObject_New(PySTEntryObject, &PySTEntry_Type);
37-
if (ste == NULL)
37+
if (ste == NULL) {
38+
Py_DECREF(k);
3839
goto fail;
40+
}
3941
ste->ste_table = st;
4042
ste->ste_id = k; /* ste owns reference to k */
4143

0 commit comments

Comments
 (0)