]> granicus.if.org Git - python/commitdiff
bpo-37954: Fix reference leak in the symtable (GH-15514)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 26 Aug 2019 15:49:44 +0000 (08:49 -0700)
committerGitHub <noreply@github.com>
Mon, 26 Aug 2019 15:49:44 +0000 (08:49 -0700)
(cherry picked from commit 4901dc46da5ecb131f8d902a0fbd704934f209e1)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Python/symtable.c

index 18ea57690b5dea7d62482dc59de29fa095fd53ae..2795e0f1115b8df9cd3344f88c560d310c2ee7d8 100644 (file)
@@ -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