Kaydet (Commit) c36179bf authored tarafından Neal Norwitz's avatar Neal Norwitz

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
üst 53960414
...@@ -1119,6 +1119,7 @@ posix_access(PyObject *self, PyObject *args) ...@@ -1119,6 +1119,7 @@ posix_access(PyObject *self, PyObject *args)
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
res = access(path, mode); res = access(path, mode);
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
PyMem_Free(path);
return(PyBool_FromLong(res == 0)); return(PyBool_FromLong(res == 0));
} }
...@@ -2950,7 +2951,7 @@ To both, return fd of newly opened pseudo-terminal.\n"); ...@@ -2950,7 +2951,7 @@ To both, return fd of newly opened pseudo-terminal.\n");
static PyObject * static PyObject *
posix_forkpty(PyObject *self, PyObject *noargs) posix_forkpty(PyObject *self, PyObject *noargs)
{ {
int master_fd, pid; int master_fd = -1, pid;
pid = forkpty(&master_fd, NULL, NULL, NULL); pid = forkpty(&master_fd, NULL, NULL, NULL);
if (pid == -1) if (pid == -1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment