From 284fa08eb783a48f98eabda25aaaebefb5937cce Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Wed, 9 May 2012 13:24:31 +0200 Subject: Issue #14761: Fix potential leak on an error case in the import machinery. --- Python/import.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Python') diff --git a/Python/import.c b/Python/import.c index 108a1e1b07..2f11e756c9 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; } -- cgit v1.2.1