summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-07-20 12:51:53 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-07-20 12:51:53 (GMT)
commit09ca794afe0fe30d7c1a04c14c2913bb1e8a4384 (patch)
tree2d75f483d27c9a1e015dbb44e092f0849c9b1c72
parent0bd447f847f285dc8f0179a03d224c4b17c8df34 (diff)
downloadcpython-09ca794afe0fe30d7c1a04c14c2913bb1e8a4384.zip
cpython-09ca794afe0fe30d7c1a04c14c2913bb1e8a4384.tar.gz
cpython-09ca794afe0fe30d7c1a04c14c2913bb1e8a4384.tar.bz2
Add missing check of PyDict_SetItem()'s return value in _PyImport_FindExtensionObject()
CID 486649
-rw-r--r--Python/import.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c
index 26261e1..e91cef8 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) {