[Python-checkins] python/dist/src/Modules posixmodule.c, 2.329.2.4, 2.329.2.5

nnorwitz@users.sourceforge.net nnorwitz at users.sourceforge.net
Mon Sep 19 08:42:34 CEST 2005


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

Modified Files:
      Tag: release24-maint
	posixmodule.c 
Log Message:
Fix problems reported by valgrind:
 * Fix memory leak in posix.access()
 * Fix use of uninitialized value in forkpty()
   - from the manpage it isn't clear if there are conditions where master_fd
     are uninitialized, but it's safer to initialize


Index: posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.329.2.4
retrieving revision 2.329.2.5
diff -u -d -r2.329.2.4 -r2.329.2.5
--- posixmodule.c	14 Sep 2005 20:51:40 -0000	2.329.2.4
+++ posixmodule.c	19 Sep 2005 06:42:30 -0000	2.329.2.5
@@ -1119,6 +1119,7 @@
 	Py_BEGIN_ALLOW_THREADS
 	res = access(path, mode);
 	Py_END_ALLOW_THREADS
+	PyMem_Free(path);
 	return(PyBool_FromLong(res == 0));
 }
 
@@ -2950,7 +2951,7 @@
 static PyObject *
 posix_forkpty(PyObject *self, PyObject *noargs)
 {
-	int master_fd, pid;
+	int master_fd = -1, pid;
 
 	pid = forkpty(&master_fd, NULL, NULL, NULL);
 	if (pid == -1)



More information about the Python-checkins mailing list