Skip to content

Commit 19435d2

Browse files
authored
gh-120385: Fix reference leak in symtable (#120386)
Decref 'new_ste' if symtable_visit_annotations() fails.
1 parent f5a9c34 commit 19435d2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Python/symtable.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2027,8 +2027,10 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
20272027
}
20282028

20292029
if (!symtable_visit_annotations(st, s, s->v.AsyncFunctionDef.args,
2030-
s->v.AsyncFunctionDef.returns, new_ste))
2030+
s->v.AsyncFunctionDef.returns, new_ste)) {
2031+
Py_DECREF(new_ste);
20312032
VISIT_QUIT(st, 0);
2033+
}
20322034
if (!symtable_enter_existing_block(st, new_ste)) {
20332035
Py_DECREF(new_ste);
20342036
VISIT_QUIT(st, 0);

0 commit comments

Comments
 (0)