diff Python/import.c @ 76846:a775fc27f469 2.7

Issue #14761: Fix potential leak on an error case in the import machinery.
author Antoine Pitrou <solipsis@pitrou.net>
date Wed, 09 May 2012 13:24:31 +0200
parents b82a471d2c5e
children bdd1b2228c14
line wrap: on
line diff
--- a/Python/import.c	Tue May 08 21:29:36 2012 -0400
+++ b/Python/import.c	Wed May 09 13:24:31 2012 +0200
@@ -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;
 }