benjamin.peterson
2008-09-04 02:28:16 UTC
Author: benjamin.peterson
Date: Thu Sep 4 04:28:15 2008
New Revision: 66204
Log:
Fix a memory leak in reloading extension modules #3667
Reviewer: Barry Warsaw
Modified:
python/branches/py3k/Python/import.c
Modified: python/branches/py3k/Python/import.c
==============================================================================
--- python/branches/py3k/Python/import.c (original)
+++ python/branches/py3k/Python/import.c Thu Sep 4 04:28:15 2008
@@ -612,7 +612,6 @@
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 @@
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);
Date: Thu Sep 4 04:28:15 2008
New Revision: 66204
Log:
Fix a memory leak in reloading extension modules #3667
Reviewer: Barry Warsaw
Modified:
python/branches/py3k/Python/import.c
Modified: python/branches/py3k/Python/import.c
==============================================================================
--- python/branches/py3k/Python/import.c (original)
+++ python/branches/py3k/Python/import.c Thu Sep 4 04:28:15 2008
@@ -612,7 +612,6 @@
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 @@
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);