about summary refs log tree commit diff
path: root/src/usr.bin/calendar/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr.bin/calendar/io.c')
-rw-r--r--src/usr.bin/calendar/io.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/usr.bin/calendar/io.c b/src/usr.bin/calendar/io.c
index f17cacb..e4cb689 100644
--- a/src/usr.bin/calendar/io.c
+++ b/src/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);