]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-120385: Fix reference leak in symtable (#120386)
authorKirill Podoprigora <kirill.bast9@mail.ru>
Wed, 12 Jun 2024 07:37:14 +0000 (10:37 +0300)
committerGitHub <noreply@github.com>
Wed, 12 Jun 2024 07:37:14 +0000 (09:37 +0200)
Decref 'new_ste' if symtable_visit_annotations() fails.

Python/symtable.c

index 287bc2bd58107d9348b69e598f0b20fa09b8c725..627184da9ef4ed9fa32f3853ccd50205f2bab37a 100644 (file)
@@ -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);