bpo-36412: fix a possible crash in dictobject.c's new_dict() (GH-12519)

This commit is contained in:
Zackery Spytz 2019-03-23 20:23:29 -06:00 committed by Inada Naoki
parent a7987e7193
commit 3d07c1ee1d
2 changed files with 4 additions and 1 deletions

View File

@ -0,0 +1 @@
Fix a possible crash when creating a new dictionary.

View 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;
}
}