mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Fix a memory leak in reloading extension modules #3667
Reviewer: Barry Warsaw
This commit is contained in:
parent
a7f4f5a772
commit
ad9565338c
1 changed files with 1 additions and 1 deletions
|
@ -612,7 +612,6 @@ _PyImport_FindExtension(char *name, char *filename)
|
|||
mod = PyImport_AddModule(name);
|
||||
if (mod == NULL)
|
||||
return NULL;
|
||||
Py_INCREF(mod);
|
||||
mdict = PyModule_GetDict(mod);
|
||||
if (mdict == NULL)
|
||||
return NULL;
|
||||
|
@ -626,6 +625,7 @@ _PyImport_FindExtension(char *name, char *filename)
|
|||
if (mod == NULL)
|
||||
return NULL;
|
||||
PyDict_SetItemString(PyImport_GetModuleDict(), name, mod);
|
||||
Py_DECREF(mod);
|
||||
}
|
||||
if (_PyState_AddModule(mod, def) < 0) {
|
||||
PyDict_DelItemString(PyImport_GetModuleDict(), name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue