[Python-checkins] commit of r41613 - python/branches/ast-arena/Python/pythonrun.c

neal.norwitz python-checkins at python.org
Mon Dec 5 08:50:50 CET 2005


Author: neal.norwitz
Date: Mon Dec  5 08:50:33 2005
New Revision: 41613

Modified:
   python/branches/ast-arena/Python/pythonrun.c
Log:
Fix leaks of arena in error paths

Modified: python/branches/ast-arena/Python/pythonrun.c
==============================================================================
--- python/branches/ast-arena/Python/pythonrun.c	(original)
+++ python/branches/ast-arena/Python/pythonrun.c	Mon Dec  5 08:50:33 2005
@@ -725,6 +725,7 @@
 	Py_XDECREF(v);
 	Py_XDECREF(w);
 	if (mod == NULL) {
+        	PyArena_Free(arena);
 		if (errcode == E_EOF) {
 			PyErr_Clear();
 			return E_EOF;
@@ -733,8 +734,10 @@
 		return -1;
 	}
 	m = PyImport_AddModule("__main__");
-	if (m == NULL)
+	if (m == NULL) {
+        	PyArena_Free(arena);
 		return -1;
+	}
 	d = PyModule_GetDict(m);
 	v = run_mod(mod, filename, d, d, flags, arena);
         PyArena_Free(arena);


More information about the Python-checkins mailing list