]> granicus.if.org Git - python/commitdiff
Fix a possible decref of a borrowed reference in symtable.c. (GH-9786)
authorZackery Spytz <zspytz@gmail.com>
Thu, 11 Oct 2018 05:05:35 +0000 (23:05 -0600)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 11 Oct 2018 05:05:35 +0000 (08:05 +0300)
Python/symtable.c

index 16b706b36338d01e9145b3a01df98b3bf1d35f82..d74f26fbe35a227d835c022e4736c97b71207c74 100644 (file)
@@ -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);