From 09ca794afe0fe30d7c1a04c14c2913bb1e8a4384 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Sat, 20 Jul 2013 14:51:53 +0200 Subject: Add missing check of PyDict_SetItem()'s return value in _PyImport_FindExtensionObject() CID 486649 --- Python/import.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) { -- cgit v0.12