From ed8af33cce5554545d2bd079b23fe551d26fb4bd Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Mon, 26 Aug 2019 08:49:44 -0700 Subject: [PATCH] bpo-37954: Fix reference leak in the symtable (GH-15514) (cherry picked from commit 4901dc46da5ecb131f8d902a0fbd704934f209e1) Co-authored-by: Pablo Galindo --- Python/symtable.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Python/symtable.c b/Python/symtable.c index 18ea57690b5..2795e0f1115 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -999,7 +999,9 @@ symtable_lookup(struct symtable *st, PyObject *name) PyObject *mangled = _Py_Mangle(st->st_private, name); if (!mangled) return 0; - return _PyST_GetSymbol(st->st_cur, mangled); + long ret = _PyST_GetSymbol(st->st_cur, mangled); + Py_DECREF(mangled); + return ret; } static int