Commits

Anonymous committed b68b135

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

Comments (0)

Files changed (1)

Modules/posixmodule.c

 	Py_BEGIN_ALLOW_THREADS
 	res = access(path, mode);
 	Py_END_ALLOW_THREADS
+	PyMem_Free(path);
 	return(PyBool_FromLong(res == 0));
 }
 
 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)