[Python-checkins] bpo-37954: Fix reference leak in the symtable (GH-15514)

Pablo Galindo webhook-mailer at python.org
Mon Aug 26 11:14:11 EDT 2019


https://github.com/python/cpython/commit/4901dc46da5ecb131f8d902a0fbd704934f209e1
commit: 4901dc46da5ecb131f8d902a0fbd704934f209e1
branch: master
author: Pablo Galindo <Pablogsal at gmail.com>
committer: GitHub <noreply at github.com>
date: 2019-08-26T16:14:07+01:00
summary:

bpo-37954: Fix reference leak in the symtable (GH-15514)

files:
M Python/symtable.c

diff --git a/Python/symtable.c b/Python/symtable.c
index 18ea57690b5d..2795e0f1115b 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



More information about the Python-checkins mailing list