From 5fb10959da9ac9e7a924e997f4c2c3924a334902 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 14 Apr 2014 22:27:31 +0000 Subject: Don't leak socketpair file descriptors if fork fails. Spotted by Balazs Kezes. --- usr.bin/tmux/job.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'usr.bin') diff --git a/usr.bin/tmux/job.c b/usr.bin/tmux/job.c index e4794174d1d..05b0eb9ef81 100644 --- a/usr.bin/tmux/job.c +++ b/usr.bin/tmux/job.c @@ -1,4 +1,4 @@ -/* $OpenBSD: job.c,v 1.32 2013/10/10 12:35:31 nicm Exp $ */ +/* $OpenBSD: job.c,v 1.33 2014/04/14 22:27:30 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -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); -- cgit v1.2.3