From: Christian Heimes Date: Sat, 20 Jul 2013 12:51:53 +0000 (+0200) Subject: Add missing check of PyDict_SetItem()'s return value in _PyImport_FindExtensionObject() X-Git-Tag: v3.4.0a1~135^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=09ca794afe0fe30d7c1a04c14c2913bb1e8a4384;p=python Add missing check of PyDict_SetItem()'s return value in _PyImport_FindExtensionObject() CID 486649 --- diff --git a/Python/import.c b/Python/import.c index 26261e1914..e91cef83ff 100644 --- a/Python/import.c +++ b/Python/import.c @@ -553,7 +553,10 @@ _PyImport_FindExtensionObject(PyObject *name, PyObject *filename) mod = def->m_base.m_init(); if (mod == NULL) return NULL; - PyDict_SetItem(PyImport_GetModuleDict(), name, mod); + if (PyDict_SetItem(PyImport_GetModuleDict(), name, mod) == -1) { + Py_DECREF(mod); + return NULL; + } Py_DECREF(mod); } if (_PyState_AddModule(mod, def) < 0) {