diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-04-28 15:18:58 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-04-28 15:18:58 +0000 |
commit | 2412efabaebeb6717fe8b02a364d700af20657da (patch) | |
tree | 2d29df9fe2b7f6313de164b05c3ec7b3334bc6d3 | |
parent | 62d4936e20cd213a9c840dab5b2d2786a66da765 (diff) |
fd leaks
-rw-r--r-- | libexec/rpc.rusersd/rusers_proc.c | 8 | ||||
-rw-r--r-- | libexec/tftpd/tftpd.c | 8 |
2 files changed, 11 insertions, 5 deletions
diff --git a/libexec/rpc.rusersd/rusers_proc.c b/libexec/rpc.rusersd/rusers_proc.c index cae0f335f83..66ab365ff38 100644 --- a/libexec/rpc.rusersd/rusers_proc.c +++ b/libexec/rpc.rusersd/rusers_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rusers_proc.c,v 1.19 2003/07/10 00:04:28 david Exp $ */ +/* $OpenBSD: rusers_proc.c,v 1.20 2004/04/28 15:18:57 deraadt Exp $ */ /*- * Copyright (c) 1993 John Brezak @@ -29,7 +29,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: rusers_proc.c,v 1.19 2003/07/10 00:04:28 david Exp $"; +static char rcsid[] = "$OpenBSD: rusers_proc.c,v 1.20 2004/04/28 15:18:57 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -132,6 +132,7 @@ rusers_num_svc(void *arg, struct svc_req *rqstp) lseek(fd, 0, SEEK_SET); ufp = fdopen(fd, "r"); if (!ufp) { + close(fd); syslog(LOG_ERR, "%m"); return (0); } @@ -164,6 +165,7 @@ do_names_3(int all) lseek(fd, 0, SEEK_SET); ufp = fdopen(fd, "r"); if (!ufp) { + close(fd); syslog(LOG_ERR, "%m"); return (NULL); } @@ -227,6 +229,7 @@ do_names_2(int all) lseek(fd, 0, SEEK_SET); ufp = fdopen(fd, "r"); if (!ufp) { + close(fd); syslog(LOG_ERR, "%m"); return (NULL); } @@ -290,6 +293,7 @@ do_names_1(int all) lseek(fd, 0, SEEK_SET); ufp = fdopen(fd, "r"); if (!ufp) { + close(fd); syslog(LOG_ERR, "%m"); return (NULL); } diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c index b09695b7f9b..3f56c4cec7d 100644 --- a/libexec/tftpd/tftpd.c +++ b/libexec/tftpd/tftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tftpd.c,v 1.33 2004/04/17 19:45:44 henning Exp $ */ +/* $OpenBSD: tftpd.c,v 1.34 2004/04/28 15:18:57 deraadt Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. @@ -37,7 +37,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)tftpd.c 5.13 (Berkeley) 2/26/91";*/ -static char rcsid[] = "$OpenBSD: tftpd.c,v 1.33 2004/04/17 19:45:44 henning Exp $"; +static char rcsid[] = "$OpenBSD: tftpd.c,v 1.34 2004/04/28 15:18:57 deraadt Exp $"; #endif /* not lint */ /* @@ -468,8 +468,10 @@ validate_access(char *filename, int mode) return (serrno + 100); } file = fdopen(fd, (mode == RRQ)? "r":"w"); - if (file == NULL) + if (file == NULL) { + close(fd); return (errno + 100); + } return (0); } |