diff options
author | 2016-08-31 09:45:00 +0000 | |
---|---|---|
committer | 2016-08-31 09:45:00 +0000 | |
commit | 9d6acea0117cbc43a90aeb54bc1bb7c1286562fb (patch) | |
tree | e01aa15f2aaca7187233ea7c97e2c0489f07b3ef | |
parent | fix fd leaks in error paths (diff) | |
download | wireguard-openbsd-9d6acea0117cbc43a90aeb54bc1bb7c1286562fb.tar.xz wireguard-openbsd-9d6acea0117cbc43a90aeb54bc1bb7c1286562fb.zip |
When iterating over the list of input files close them when
processing of each is done.
ok guenther@
-rw-r--r-- | usr.bin/vis/vis.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/vis/vis.c b/usr.bin/vis/vis.c index cf5cd8449c1..38aa9d70415 100644 --- a/usr.bin/vis/vis.c +++ b/usr.bin/vis/vis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vis.c,v 1.19 2015/10/09 01:37:09 deraadt Exp $ */ +/* $OpenBSD: vis.c,v 1.20 2016/08/31 09:45:00 jsg Exp $ */ /* $NetBSD: vis.c,v 1.4 1994/12/20 16:13:03 jtc Exp $ */ /*- @@ -111,9 +111,10 @@ main(int argc, char *argv[]) if (*argv) while (*argv) { - if ((fp=fopen(*argv, "r")) != NULL) + if ((fp=fopen(*argv, "r")) != NULL) { process(fp); - else + fclose(fp); + } else warn("%s", *argv); argv++; } |