diff Python/import.c @ 76847:9de4d85e4197 3.2

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 daed636a3536
children 56dc7b09f390 840cb46d0395
line wrap: on
line diff
--- a/Python/import.c	Tue May 08 21:28:24 2012 -0400
+++ b/Python/import.c	Wed May 09 13:24:31 2012 +0200
@@ -1293,7 +1293,7 @@
     FILE *fpc;
     char *buf;
     char *cpathname;
-    PyCodeObject *co;
+    PyCodeObject *co = NULL;
     PyObject *m;
 
     if (fstat(fileno(fp), &st) != 0) {
@@ -1350,6 +1350,7 @@
     return m;
 
 error_exit:
+    Py_XDECREF(co);
     PyMem_FREE(buf);
     return NULL;
 }