summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2014-01-22 09:45:21 +0000
committerjsg <jsg@openbsd.org>2014-01-22 09:45:21 +0000
commit7def82c92495092c57ec5797d5ffca39e04415ae (patch)
tree5188fae655b6f6ca1d7833e3762724ff75aa4ce7
parentfix fd leaks in error paths (diff)
downloadwireguard-openbsd-7def82c92495092c57ec5797d5ffca39e04415ae.tar.xz
wireguard-openbsd-7def82c92495092c57ec5797d5ffca39e04415ae.zip
fix an fd leak
ok krw@ deraadt@
-rw-r--r--usr.bin/unvis/unvis.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/unvis/unvis.c b/usr.bin/unvis/unvis.c
index 355a19b5676..c5cd0087fc7 100644
--- a/usr.bin/unvis/unvis.c
+++ b/usr.bin/unvis/unvis.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unvis.c,v 1.11 2013/11/27 13:32:02 okan Exp $ */
+/* $OpenBSD: unvis.c,v 1.12 2014/01/22 09:45:21 jsg Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -55,9 +55,10 @@ main(int argc, char *argv[])
if (*argv)
while (*argv) {
- if ((fp=fopen(*argv, "r")) != NULL)
+ if ((fp=fopen(*argv, "r")) != NULL) {
process(fp, *argv);
- else
+ fclose(fp);
+ } else
warn("%s", *argv);
argv++;
}