diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-07-06 04:28:59 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-07-06 04:28:59 (GMT) |
commit | a4df11d9c34952ae6d98b17fb92cbb35f8880cc8 (patch) | |
tree | 871961fc9b7d838f0b80c284ba3a4aaa8a4a1baa /Python/import.c | |
parent | d41f4ce0c8c60d4b10e44653f3a39e9d8ba2b6dc (diff) | |
download | cpython-a4df11d9c34952ae6d98b17fb92cbb35f8880cc8.zip cpython-a4df11d9c34952ae6d98b17fb92cbb35f8880cc8.tar.gz cpython-a4df11d9c34952ae6d98b17fb92cbb35f8880cc8.tar.bz2 |
Fix refleaks reported by Shane Hathaway in SF patch #1515361. This change
contains only the changes related to leaking the copy variable.
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c index c49a91f..933f094 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1237,8 +1237,10 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, importer = get_path_importer(path_importer_cache, path_hooks, v); - if (importer == NULL) + if (importer == NULL) { + Py_XDECREF(copy); return NULL; + } /* Note: importer is a borrowed reference */ if (importer == Py_False) { /* Cached as not being a valid dir. */ @@ -1273,6 +1275,7 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, loader = PyObject_CallMethod(importer, "find_module", "s", fullname); + Py_XDECREF(copy); if (loader == NULL) return NULL; /* error */ if (loader != Py_None) { @@ -1281,7 +1284,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, return &importhookdescr; } Py_DECREF(loader); - Py_XDECREF(copy); continue; } } |