]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix a possible decref of a borrowed reference in symtable.c. (GH-9786)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 11 Oct 2018 05:28:08 +0000 (22:28 -0700)
committerGitHub <noreply@github.com>
Thu, 11 Oct 2018 05:28:08 +0000 (22:28 -0700)
(cherry picked from commit fc439d20de32b0ebccca79a96e31f83b85ec4eaf)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Python/symtable.c

index 6165cfe162eac0690ad68795f70babf05c0a2397..90b07efa0334cc44f6b7cfe2562f0224ef936c05 100644 (file)
@@ -628,8 +628,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);