From a47d2397dfccfdebc26cfaca924cca8cff904235 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 14 Apr 2014 22:27:30 +0000 Subject: [PATCH] Don't leak socketpair file descriptors if fork fails. Spotted by Balazs Kezes. --- job.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/job.c b/job.c index e8006308..a8e6d33a 100644 --- a/job.c +++ b/job.c @@ -60,6 +60,8 @@ job_run(const char *cmd, struct session *s, switch (pid = fork()) { case -1: environ_free(&env); + close(out[0]); + close(out[1]); return (NULL); case 0: /* child */ clear_signals(1);