From: Serhiy Storchaka Date: Tue, 20 Oct 2015 15:21:48 +0000 (+0300) Subject: Issue #25410: Fixed a memory leak in OrderedDict in the case when key's hash X-Git-Tag: v3.5.1rc1~141 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d17427b7bd69644bbbd3ccb97dcb920ac50197a6;p=python Issue #25410: Fixed a memory leak in OrderedDict in the case when key's hash calculation fails. --- diff --git a/Objects/odictobject.c b/Objects/odictobject.c index 0044b32974..a0288841a4 100644 --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -648,11 +648,11 @@ _odict_add_new_node(PyODictObject *od, PyObject *key) Py_ssize_t i; _ODictNode *node; - Py_INCREF(key); hash = PyObject_Hash(key); if (hash == -1) return -1; + Py_INCREF(key); i = _odict_get_index(od, key); if (i < 0) { if (!PyErr_Occurred())