diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-05-09 11:24:31 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-05-09 11:24:31 (GMT) |
commit | d576c711a510204604f707e1cbf773b4a39f21a3 (patch) | |
tree | 9c43e94c0c824da7a96ee4999fb06e7ebc46bbe2 | |
parent | b98b37f10139ab92b265c11455eaaa353f04325f (diff) | |
download | cpython-d576c711a510204604f707e1cbf773b4a39f21a3.zip cpython-d576c711a510204604f707e1cbf773b4a39f21a3.tar.gz cpython-d576c711a510204604f707e1cbf773b4a39f21a3.tar.bz2 |
Issue #14761: Fix potential leak on an error case in the import machinery.
-rw-r--r-- | Misc/ACKS | 1 | ||||
-rw-r--r-- | Misc/NEWS | 2 | ||||
-rw-r--r-- | Python/import.c | 3 |
3 files changed, 5 insertions, 1 deletions
@@ -145,6 +145,7 @@ Tony Campbell Brett Cannon Mike Carlton Terry Carroll +Damien Cassou Lorenzo M. Catucci Donn Cave Charles Cazabon @@ -10,6 +10,8 @@ What's New in Python 3.2.4 Core and Builtins ----------------- +- Issue #14761: Fix potential leak on an error case in the import machinery. + - Issue #14699: Fix calling the classmethod descriptor directly. - Issue #14433: Prevent msvcrt crash in interactive prompt when stdin diff --git a/Python/import.c b/Python/import.c index 1d3a485..598b7e0 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1293,7 +1293,7 @@ load_source_module(char *name, char *pathname, FILE *fp) FILE *fpc; char *buf; char *cpathname; - PyCodeObject *co; + PyCodeObject *co = NULL; PyObject *m; if (fstat(fileno(fp), &st) != 0) { @@ -1350,6 +1350,7 @@ load_source_module(char *name, char *pathname, FILE *fp) return m; error_exit: + Py_XDECREF(co); PyMem_FREE(buf); return NULL; } |