summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-07-20 12:52:18 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-07-20 12:52:18 (GMT)
commit74ba26a40c3f7bed538aa9ab12db28da82a45685 (patch)
tree75cc5b2ba03273338fb05e4f21ff539c049de008 /Python/import.c
parent895bdfb16ef87499d08342294d0f818914e85f66 (diff)
parent09ca794afe0fe30d7c1a04c14c2913bb1e8a4384 (diff)
downloadcpython-74ba26a40c3f7bed538aa9ab12db28da82a45685.zip
cpython-74ba26a40c3f7bed538aa9ab12db28da82a45685.tar.gz
cpython-74ba26a40c3f7bed538aa9ab12db28da82a45685.tar.bz2
Add missing check of PyDict_SetItem()'s return value in _PyImport_FindExtensionObject()
CID 486649
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c
index a1c0aee..c6222ec 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -585,7 +585,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) {