diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-09-04 02:28:15 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-09-04 02:28:15 (GMT) |
commit | ad9565338c10be8c1ff14b234cb0bb0dde2b80f6 (patch) | |
tree | 47c2608c3a7d99d50dc52cc618692bc6ccd56791 /Python | |
parent | a7f4f5a772163322178ccb4c954e3bd04da5317f (diff) | |
download | cpython-ad9565338c10be8c1ff14b234cb0bb0dde2b80f6.zip cpython-ad9565338c10be8c1ff14b234cb0bb0dde2b80f6.tar.gz cpython-ad9565338c10be8c1ff14b234cb0bb0dde2b80f6.tar.bz2 |
Fix a memory leak in reloading extension modules #3667
Reviewer: Barry Warsaw
Diffstat (limited to 'Python')
-rw-r--r-- | Python/import.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c index 8159b5e..d87d751 100644 --- a/Python/import.c +++ b/Python/import.c @@ -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); |