From c01980f9dcae8715201681f70e6777d129a27074 Mon Sep 17 00:00:00 2001 From: matthew <> Date: Tue, 21 May 2013 19:07:02 +0000 Subject: [PATCH] Fix pty descriptor leak if fork() fails. ok millert --- src/lib/libutil/pty.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/libutil/pty.c b/src/lib/libutil/pty.c index 2fb20880..598b8fa1 100644 --- a/src/lib/libutil/pty.c +++ b/src/lib/libutil/pty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pty.c,v 1.18 2012/12/05 23:20:06 deraadt Exp $ */ +/* $OpenBSD: pty.c,v 1.19 2013/05/21 19:07:02 matthew Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -89,6 +89,8 @@ forkpty(int *amaster, char *name, struct termios *termp, struct winsize *winp) return (-1); switch (pid = fork()) { case -1: + (void) close(master); + (void) close(slave); return (-1); case 0: /*