summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2014-04-14 22:27:31 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2014-04-14 22:27:31 +0000
commit5fb10959da9ac9e7a924e997f4c2c3924a334902 (patch)
tree4bc14faa841dec71dc92ad85734c6b9f411c1d7e /usr.bin
parent2d157b40fc69b0196c17decc3493b9dcb0932d4f (diff)
Don't leak socketpair file descriptors if fork fails. Spotted by Balazs
Kezes.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/job.c4
1 files changed, 3 insertions, 1 deletions
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 <nicm@users.sourceforge.net>
@@ -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);