From: Neal Norwitz Date: Mon, 19 Sep 2005 06:42:30 +0000 (+0000) Subject: Fix problems reported by valgrind: X-Git-Tag: v2.4.2c1~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c36179bf814b7075fe3341807ff0eac40c55dec7;p=thirdparty%2FPython%2Fcpython.git 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 --- diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index a116c41d5e10..0649854f5524 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -1119,6 +1119,7 @@ posix_access(PyObject *self, PyObject *args) Py_BEGIN_ALLOW_THREADS res = access(path, mode); Py_END_ALLOW_THREADS + PyMem_Free(path); return(PyBool_FromLong(res == 0)); } @@ -2950,7 +2951,7 @@ To both, return fd of newly opened pseudo-terminal.\n"); 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)