X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/038ec85e825fc940c1387f64a88ae73b75f6822b..5fd70d0768f86274b22e73f3cd8f59fec0325e36:/unix/uxproxy.c diff --git a/unix/uxproxy.c b/unix/uxproxy.c index 9dee690e..f808a677 100644 --- a/unix/uxproxy.c +++ b/unix/uxproxy.c @@ -288,6 +288,7 @@ Socket platform_new_connection(SockAddr addr, char *hostname, if (pipe(to_cmd_pipe) < 0 || pipe(from_cmd_pipe) < 0) { ret->error = dupprintf("pipe: %s", strerror(errno)); + sfree(cmd); return (Socket)ret; } cloexec(to_cmd_pipe[1]); @@ -306,8 +307,8 @@ Socket platform_new_connection(SockAddr addr, char *hostname, dup2(from_cmd_pipe[1], 1); close(to_cmd_pipe[0]); close(from_cmd_pipe[1]); - fcntl(0, F_SETFD, 0); - fcntl(1, F_SETFD, 0); + noncloexec(0); + noncloexec(1); execl("/bin/sh", "sh", "-c", cmd, (void *)NULL); _exit(255); }