]> granicus.if.org Git - python/commitdiff
bpo-36412: fix a possible crash in dictobject.c's new_dict() (GH-12519)
authorZackery Spytz <zspytz@gmail.com>
Sun, 24 Mar 2019 02:23:29 +0000 (20:23 -0600)
committerInada Naoki <songofacandy@gmail.com>
Sun, 24 Mar 2019 02:23:29 +0000 (11:23 +0900)
Misc/NEWS.d/next/Core and Builtins/2019-03-23-19-51-09.bpo-36412.C7acGn.rst [new file with mode: 0644]
Objects/dictobject.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-03-23-19-51-09.bpo-36412.C7acGn.rst b/Misc/NEWS.d/next/Core and Builtins/2019-03-23-19-51-09.bpo-36412.C7acGn.rst
new file mode 100644 (file)
index 0000000..0146988
--- /dev/null
@@ -0,0 +1 @@
+Fix a possible crash when creating a new dictionary.
index 524ff67837bcf70eb2a21ba0aee463d98757524e..e2603e190b62ef951639fe6b7823735ce7649743 100644 (file)
@@ -604,7 +604,9 @@ new_dict(PyDictKeysObject *keys, PyObject **values)
         mp = PyObject_GC_New(PyDictObject, &PyDict_Type);
         if (mp == NULL) {
             dictkeys_decref(keys);
-            free_values(values);
+            if (values != empty_values) {
+                free_values(values);
+            }
             return NULL;
         }
     }