Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b68cd42

Browse files
committed
Fix two smal memory leaks discovered by Vadim Chugunov.
1 parent f811dca commit b68cd42

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Python/import.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,6 @@ load_package(name, pathname)
779779
if (fp != NULL)
780780
fclose(fp);
781781
cleanup:
782-
Py_XINCREF(m);
783782
Py_XDECREF(path);
784783
Py_XDECREF(file);
785784
return m;
@@ -1712,8 +1711,8 @@ import_submodule(mod, subname, fullname)
17121711
}
17131712

17141713
buf[0] = '\0';
1715-
fdp = find_module(subname, path,
1716-
buf, MAXPATHLEN+1, &fp);
1714+
fdp = find_module(subname, path, buf, MAXPATHLEN+1, &fp);
1715+
Py_XDECREF(path);
17171716
if (fdp == NULL) {
17181717
if (!PyErr_ExceptionMatches(PyExc_ImportError))
17191718
return NULL;

0 commit comments

Comments
 (0)