summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-03-07 20:00:16 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-03-07 20:00:16 +0000
commit6067472b30ccd42b848459e34b7d3376419e1e88 (patch)
treed396079625b986116c7dc345fe5b3f7f5224d264 /lib/libc
parent7e26a82d8c9ab5e1c3a2a81b8d4002b400517c3b (diff)
fd leak; andrushock@korovino.net
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/rcmd.c6
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) {