[Python-checkins] cpython (2.7): Issue #14761: Fix potential leak on an error case in the import machinery.
antoine.pitrou
python-checkins at python.org
Wed May 9 13:27:18 CEST 2012
http://hg.python.org/cpython/rev/a775fc27f469
changeset: 76846:a775fc27f469
branch: 2.7
parent: 76844:5683ca62a954
user: Antoine Pitrou <solipsis at pitrou.net>
date: Wed May 09 13:24:31 2012 +0200
summary:
Issue #14761: Fix potential leak on an error case in the import machinery.
files:
Misc/ACKS | 1 +
Misc/NEWS | 2 ++
Python/import.c | 3 ++-
3 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -127,6 +127,7 @@
Brett Cannon
Mike Carlton
Terry Carroll
+Damien Cassou
Lorenzo M. Catucci
Donn Cave
Charles Cazabon
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -9,6 +9,8 @@
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 #11603 (again): Setting __repr__ to __str__ now raises a RuntimeError
diff --git a/Python/import.c b/Python/import.c
--- a/Python/import.c
+++ b/Python/import.c
@@ -998,7 +998,7 @@
FILE *fpc;
char *buf;
char *cpathname;
- PyCodeObject *co;
+ PyCodeObject *co = NULL;
PyObject *m;
if (fstat(fileno(fp), &st) != 0) {
@@ -1054,6 +1054,7 @@
return m;
error_exit:
+ Py_XDECREF(co);
PyMem_FREE(buf);
return NULL;
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list