Issue #25410: Fixed a memory leak in OrderedDict in the case when key's hash
calculation fails.
This commit is contained in:
parent
ae94062ae9
commit
d17427b7bd
|
@ -648,11 +648,11 @@ _odict_add_new_node(PyODictObject *od, PyObject *key)
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
_ODictNode *node;
|
_ODictNode *node;
|
||||||
|
|
||||||
Py_INCREF(key);
|
|
||||||
hash = PyObject_Hash(key);
|
hash = PyObject_Hash(key);
|
||||||
if (hash == -1)
|
if (hash == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
Py_INCREF(key);
|
||||||
i = _odict_get_index(od, key);
|
i = _odict_get_index(od, key);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
if (!PyErr_Occurred())
|
if (!PyErr_Occurred())
|
||||||
|
|
Loading…
Reference in New Issue