]> granicus.if.org Git - python/commitdiff
Issue #14761: Fix potential leak on an error case in the import machinery.
authorAntoine Pitrou <solipsis@pitrou.net>
Wed, 9 May 2012 11:24:31 +0000 (13:24 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Wed, 9 May 2012 11:24:31 +0000 (13:24 +0200)
Misc/ACKS
Misc/NEWS
Python/import.c

index bf686f49ddffc44abfd0a8a9ecc2fabd36dce695..2fb33823edb26012ff7522eec56c73b44d5d5161 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -127,6 +127,7 @@ Tony Campbell
 Brett Cannon
 Mike Carlton
 Terry Carroll
+Damien Cassou
 Lorenzo M. Catucci
 Donn Cave
 Charles Cazabon
index 1ac29ff758ac5f02c0021898f5ce216e25e82ed5..29e6dadaa529a1a648274b4412f83f1d4208ad2e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -9,6 +9,8 @@ What's New in Python 2.7.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 #11603 (again): Setting __repr__ to __str__ now raises a RuntimeError
index 108a1e1b0741c0ba8194609235618286398998cb..2f11e756c92ca0f7d2dc72d2df02200c347cdff5 100644 (file)
@@ -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;
 }