summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2016-08-31 09:38:47 +0000
committerjsg <jsg@openbsd.org>2016-08-31 09:38:47 +0000
commit42f8ee748c70bfe5b57ebe8d4112225c99a6b789 (patch)
tree03ad4f36200d5806f449d84230c996784359488d
parentuse tab. (diff)
downloadwireguard-openbsd-42f8ee748c70bfe5b57ebe8d4112225c99a6b789.tar.xz
wireguard-openbsd-42f8ee748c70bfe5b57ebe8d4112225c99a6b789.zip
fix fd leaks in error paths
ok guenther@
-rw-r--r--usr.bin/calendar/io.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/calendar/io.c b/usr.bin/calendar/io.c
index f17cacbd8ed..e4cb689b940 100644
--- a/usr.bin/calendar/io.c
+++ b/usr.bin/calendar/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.43 2015/12/08 19:04:50 mmcc Exp $ */
+/* $OpenBSD: io.c,v 1.44 2016/08/31 09:38:47 jsg Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@@ -335,12 +335,15 @@ opencal(void)
}
}
- if (pipe(pdes) < 0)
+ if (pipe(pdes) < 0) {
+ close(fdin);
return (NULL);
+ }
switch (vfork()) {
case -1: /* error */
(void)close(pdes[0]);
(void)close(pdes[1]);
+ close(fdin);
return (NULL);
case 0:
dup2(fdin, STDIN_FILENO);