summaryrefslogtreecommitdiff
path: root/usr.bin/ctfconv
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2017-09-19 08:28:58 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2017-09-19 08:28:58 +0000
commit0025421be784b59ea032a49e481eb91dc044c3ec (patch)
tree79254426b60580e10abbacc52dc4bc90bdddcec4 /usr.bin/ctfconv
parentdb27b941576ea243babbf1718362326d0ffc082d (diff)
fix fd leaks in error paths
ok mpi@
Diffstat (limited to 'usr.bin/ctfconv')
-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;
}