diff options
author | 2005-03-07 20:00:15 +0000 | |
---|---|---|
committer | 2005-03-07 20:00:15 +0000 | |
commit | 02cf1ae2bbdc62258c02bc8efd0b705dbd712ee8 (patch) | |
tree | 9603907392ef761fe382923fe600ab1123bd9cba /lib/libc/net/rcmd.c | |
parent | use rcs_kflag_get() and RCS_KWEXP_INVAL() to check for valid (diff) | |
download | wireguard-openbsd-02cf1ae2bbdc62258c02bc8efd0b705dbd712ee8.tar.xz wireguard-openbsd-02cf1ae2bbdc62258c02bc8efd0b705dbd712ee8.zip |
fd leak; andrushock@korovino.net
Diffstat (limited to 'lib/libc/net/rcmd.c')
-rw-r--r-- | lib/libc/net/rcmd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c index b99a35b38cf..4aa32611332 100644 --- a/lib/libc/net/rcmd.c +++ b/lib/libc/net/rcmd.c @@ -29,7 +29,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: rcmd.c,v 1.49 2004/11/17 01:42:26 itojun Exp $"; +static char *rcsid = "$OpenBSD: rcmd.c,v 1.50 2005/03/07 20:00:15 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -213,8 +213,10 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) if (s2 < 0) goto bad; readsp = (fd_set *)malloc(fdssize); - if (readsp == NULL) + if (readsp == NULL) { + close(s2); goto bad; + } listen(s2, 1); (void)snprintf(num, sizeof(num), "%d", lport); if (write(s, num, strlen(num)+1) != strlen(num)+1) { |