summaryrefslogtreecommitdiffstats
path: root/usr.bin/ctfconv/ctfconv.c
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2017-09-19 08:28:57 +0000
committerjsg <jsg@openbsd.org>2017-09-19 08:28:57 +0000
commitc8f519c3aeb8c57b1150655e4c84fa11508be5b7 (patch)
tree9f3a400fb0a6af77f08253c8f5ddf3a500cd7bd8 /usr.bin/ctfconv/ctfconv.c
parentClarify a wrong conditional, found by jsg. (diff)
downloadwireguard-openbsd-c8f519c3aeb8c57b1150655e4c84fa11508be5b7.tar.xz
wireguard-openbsd-c8f519c3aeb8c57b1150655e4c84fa11508be5b7.zip
fix fd leaks in error paths
ok mpi@
Diffstat (limited to 'usr.bin/ctfconv/ctfconv.c')
-rw-r--r--usr.bin/ctfconv/ctfconv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/ctfconv/ctfconv.c b/usr.bin/ctfconv/ctfconv.c
index 1d3b3921c7d..89af54a7131 100644
--- a/usr.bin/ctfconv/ctfconv.c
+++ b/usr.bin/ctfconv/ctfconv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ctfconv.c,v 1.8 2017/08/29 21:10:20 deraadt Exp $ */
+/* $OpenBSD: ctfconv.c,v 1.9 2017/09/19 08:28:57 jsg Exp $ */
/*
* Copyright (c) 2016-2017 Martin Pieuchot
@@ -180,10 +180,12 @@ convert(const char *path)
}
if (fstat(fd, &st) == -1) {
warn("fstat %s", path);
+ close(fd);
return 1;
}
if ((uintmax_t)st.st_size > SIZE_MAX) {
warnx("file too big to fit memory");
+ close(fd);
return 1;
}