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 | 284fa08eb783a48f98eabda25aaaebefb5937cce (patch) | |
tree | c9e72f74afdb6b8fa20a86b911c0a9a101c14af4 /Python | |
parent | 5ec0340ce1927a2220a0fc510f2f9968d05917eb (diff) | |
download | cpython-284fa08eb783a48f98eabda25aaaebefb5937cce.zip cpython-284fa08eb783a48f98eabda25aaaebefb5937cce.tar.gz cpython-284fa08eb783a48f98eabda25aaaebefb5937cce.tar.bz2 |
Issue #14761: Fix potential leak on an error case in the import machinery.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/import.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c index 108a1e1..2f11e75 100644 --- a/Python/import.c +++ b/Python/import.c @@ -998,7 +998,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) { @@ -1054,6 +1054,7 @@ load_source_module(char *name, char *pathname, FILE *fp) return m; error_exit: + Py_XDECREF(co); PyMem_FREE(buf); return NULL; } |