mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
Fix potential NULL pointer dereference in _imp_create_builtin
PyModule_GetDef() can return NULL. Let's check the return value properly like in the other five cases. CID 1299590
This commit is contained in:
parent
4f29e75289
commit
a78b627e2b
1 changed files with 4 additions and 0 deletions
|
@ -1077,6 +1077,10 @@ _imp_create_builtin(PyObject *module, PyObject *spec)
|
|||
} else {
|
||||
/* Remember pointer to module init function. */
|
||||
def = PyModule_GetDef(mod);
|
||||
if (def == NULL) {
|
||||
Py_DECREF(name);
|
||||
return NULL;
|
||||
}
|
||||
def->m_base.m_init = p->initfunc;
|
||||
if (_PyImport_FixupExtensionObject(mod, name, name) < 0) {
|
||||
Py_DECREF(name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue