[Python-checkins] python/dist/src/Python import.c, 2.208.2.5, 2.208.2.6 pythonrun.c, 2.161.2.17, 2.161.2.18

nnorwitz@users.sourceforge.net nnorwitz at users.sourceforge.net
Fri Oct 14 09:21:30 CEST 2005


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21447/Python

Modified Files:
      Tag: ast-branch
	import.c pythonrun.c 
Log Message:
Fix memory leaks

Index: import.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/import.c,v
retrieving revision 2.208.2.5
retrieving revision 2.208.2.6
diff -u -d -r2.208.2.5 -r2.208.2.6
--- import.c	7 Jan 2005 07:04:42 -0000	2.208.2.5
+++ import.c	14 Oct 2005 07:21:26 -0000	2.208.2.6
@@ -761,8 +761,10 @@
 
 	mod = PyParser_ASTFromFile(fp, pathname, Py_file_input, 0, 0, 0, 
 				   NULL);
-	if (mod)
+	if (mod) {
 		co = PyAST_Compile(mod, pathname, NULL);
+		free_mod(mod);
+	}
 	return co;
 }
 

Index: pythonrun.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v
retrieving revision 2.161.2.17
retrieving revision 2.161.2.18
diff -u -d -r2.161.2.17 -r2.161.2.18
--- pythonrun.c	11 Oct 2005 22:03:13 -0000	2.161.2.17
+++ pythonrun.c	14 Oct 2005 07:21:27 -0000	2.161.2.18
@@ -1150,8 +1150,11 @@
 PyRun_StringFlags(const char *str, int start, PyObject *globals, 
 		  PyObject *locals, PyCompilerFlags *flags)
 {
+	PyObject *ret;
 	mod_ty mod = PyParser_ASTFromString(str, "<string>", start, flags);
-	return run_err_mod(mod, "<string>", globals, locals, flags);
+	ret = run_err_mod(mod, "<string>", globals, locals, flags);
+	free_mod(mod);
+	return ret;
 }
 
 PyObject *



More information about the Python-checkins mailing list