Add missing check of PyDict_SetItem()'s return value in _PyImport_FindExtensionObject()

CID 486649
This commit is contained in:
Christian Heimes 2013-07-20 14:51:53 +02:00
parent 0bd447f847
commit 09ca794afe
1 changed files with 4 additions and 1 deletions

View File

@ -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) {