From: Kirill Podoprigora Date: Wed, 12 Jun 2024 07:37:14 +0000 (+0300) Subject: gh-120385: Fix reference leak in symtable (#120386) X-Git-Tag: v3.14.0a1~1528 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=19435d299a1fae9ad9a6bbe6609e41ddfd7f6cbe;p=thirdparty%2FPython%2Fcpython.git gh-120385: Fix reference leak in symtable (#120386) Decref 'new_ste' if symtable_visit_annotations() fails. --- diff --git a/Python/symtable.c b/Python/symtable.c index 287bc2bd5810..627184da9ef4 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);