diff options
author | Zackery Spytz <zspytz@gmail.com> | 2019-03-24 02:23:29 (GMT) |
---|---|---|
committer | Inada Naoki <songofacandy@gmail.com> | 2019-03-24 02:23:29 (GMT) |
commit | 3d07c1ee1d2d475b74816117981d6ec752c26c23 (patch) | |
tree | ff27179fff70f36717b3da0cade794ca81f6cf54 | |
parent | a7987e71939fa631296f83861fb376361ddd59ee (diff) | |
download | cpython-3d07c1ee1d2d475b74816117981d6ec752c26c23.zip cpython-3d07c1ee1d2d475b74816117981d6ec752c26c23.tar.gz cpython-3d07c1ee1d2d475b74816117981d6ec752c26c23.tar.bz2 |
bpo-36412: fix a possible crash in dictobject.c's new_dict() (GH-12519)
-rw-r--r-- | Misc/NEWS.d/next/Core and Builtins/2019-03-23-19-51-09.bpo-36412.C7acGn.rst | 1 | ||||
-rw-r--r-- | Objects/dictobject.c | 4 |
2 files changed, 4 insertions, 1 deletions
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 index 0000000..0146988 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-03-23-19-51-09.bpo-36412.C7acGn.rst @@ -0,0 +1 @@ +Fix a possible crash when creating a new dictionary. diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 524ff67..e2603e1 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -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; } } |