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

Serhiy Storchaka webhook-mailer at python.org
Thu Oct 11 01:05:39 EDT 2018


https://github.com/python/cpython/commit/fc439d20de32b0ebccca79a96e31f83b85ec4eaf
commit: fc439d20de32b0ebccca79a96e31f83b85ec4eaf
branch: master
author: Zackery Spytz <zspytz at gmail.com>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2018-10-11T08:05:35+03:00
summary:

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

files:
M Python/symtable.c

diff --git a/Python/symtable.c b/Python/symtable.c
index 16b706b36338..d74f26fbe35a 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