summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorKirill Podoprigora <kirill.bast9@mail.ru>2024-06-12 07:37:14 (GMT)
committerGitHub <noreply@github.com>2024-06-12 07:37:14 (GMT)
commit19435d299a1fae9ad9a6bbe6609e41ddfd7f6cbe (patch)
treec37c1af815dcd04060dbe3eb46b1537d64189f18 /Python
parentf5a9c34f38886c5cf9c2f8d860eee3473447e030 (diff)
downloadcpython-19435d299a1fae9ad9a6bbe6609e41ddfd7f6cbe.zip
cpython-19435d299a1fae9ad9a6bbe6609e41ddfd7f6cbe.tar.gz
cpython-19435d299a1fae9ad9a6bbe6609e41ddfd7f6cbe.tar.bz2
gh-120385: Fix reference leak in symtable (#120386)
Decref 'new_ste' if symtable_visit_annotations() fails.
Diffstat (limited to 'Python')
-rw-r--r--Python/symtable.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/symtable.c b/Python/symtable.c
index 287bc2b..627184d 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -2027,8 +2027,10 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
}
if (!symtable_visit_annotations(st, s, s->v.AsyncFunctionDef.args,
- s->v.AsyncFunctionDef.returns, new_ste))
+ s->v.AsyncFunctionDef.returns, new_ste)) {
+ Py_DECREF(new_ste);
VISIT_QUIT(st, 0);
+ }
if (!symtable_enter_existing_block(st, new_ste)) {
Py_DECREF(new_ste);
VISIT_QUIT(st, 0);