summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjasper <jasper@openbsd.org>2010-12-10 09:48:43 +0000
committerjasper <jasper@openbsd.org>2010-12-10 09:48:43 +0000
commit0c4f1d945c23c5155dd8805929eca8669c1f219e (patch)
treec911fda9a9d6957e238c9050d212540d96fbe1e4
parentThere's no need to flush the cache for the FPU state ever since we got rid (diff)
downloadwireguard-openbsd-0c4f1d945c23c5155dd8805929eca8669c1f219e.tar.xz
wireguard-openbsd-0c4f1d945c23c5155dd8805929eca8669c1f219e.zip
- plug an fd leak
help/ok chl@ nicm@
-rw-r--r--usr.bin/rcs/rcs.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/rcs/rcs.c b/usr.bin/rcs/rcs.c
index 0b0c158e86b..afe14aeb6e6 100644
--- a/usr.bin/rcs/rcs.c
+++ b/usr.bin/rcs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.71 2010/10/27 08:35:45 tobias Exp $ */
+/* $OpenBSD: rcs.c,v 1.72 2010/12/10 09:48:43 jasper Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -474,11 +474,14 @@ rcs_movefile(char *from, char *to, mode_t perm, u_int to_flags)
}
if ((dst = fopen(to, "w")) == NULL) {
warn("%s", to);
+ (void)fclose(src);
return (-1);
}
if (fchmod(fileno(dst), perm)) {
warn("%s", to);
(void)unlink(to);
+ (void)fclose(src);
+ (void)fclose(dst);
return (-1);
}
@@ -499,11 +502,11 @@ rcs_movefile(char *from, char *to, mode_t perm, u_int to_flags)
ret = 0;
- (void)fclose(src);
- (void)fclose(dst);
(void)unlink(from);
out:
+ (void)fclose(src);
+ (void)fclose(dst);
xfree(buf);
return (ret);