X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/bc06669bcf2c0d331e231d18c0e14023433f9e79..3d5040f8f85f049cbb072a827a6184b4b4314b08:/unix/uxproxy.c diff --git a/unix/uxproxy.c b/unix/uxproxy.c index def8a40a..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]); @@ -297,6 +298,7 @@ Socket platform_new_connection(SockAddr addr, char *hostname, if (pid < 0) { ret->error = dupprintf("fork: %s", strerror(errno)); + sfree(cmd); return (Socket)ret; } else if (pid == 0) { close(0); @@ -305,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); }