[Python-checkins] Fix a possible decref of a borrowed reference in symtable.c. (GH-9786)

Miss Islington (bot) webhook-mailer at python.org
Thu Oct 11 01:24:20 EDT 2018


https://github.com/python/cpython/commit/1c2cb516e49ceb56f76e90645e67e8df4e5df01a
commit: 1c2cb516e49ceb56f76e90645e67e8df4e5df01a
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-10-10T22:24:14-07:00
summary:

Fix a possible decref of a borrowed reference in symtable.c. (GH-9786)

(cherry picked from commit fc439d20de32b0ebccca79a96e31f83b85ec4eaf)

Co-authored-by: Zackery Spytz <zspytz at gmail.com>

files:
M Python/symtable.c

diff --git a/Python/symtable.c b/Python/symtable.c
index 1c328a996140..81eea95f4907 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -625,8 +625,10 @@ update_symbols(PyObject *symbols, PyObject *scopes,
         return 0;
 
     itr = PyObject_GetIter(free);
-    if (!itr)
-        goto error;
+    if (itr == NULL) {
+        Py_DECREF(v_free);
+        return 0;
+    }
 
     while ((name = PyIter_Next(itr))) {
         v = PyDict_GetItem(symbols, name);



More information about the Python-checkins mailing list