summaryrefslogtreecommitdiffstats
path: root/usr.bin/mg/cscope.c
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2014-01-22 09:43:53 +0000
committerjsg <jsg@openbsd.org>2014-01-22 09:43:53 +0000
commita0b8e70d1ba75dfdfb0117c45a0e5f2671da126f (patch)
tree5960d8c5105457c304d48196e7fb785f73c4e7e6 /usr.bin/mg/cscope.c
parentAdd a debug flag for rebuild. (diff)
downloadwireguard-openbsd-a0b8e70d1ba75dfdfb0117c45a0e5f2671da126f.tar.xz
wireguard-openbsd-a0b8e70d1ba75dfdfb0117c45a0e5f2671da126f.zip
fix fd leaks in error paths
ok krw@ phessler@
Diffstat (limited to 'usr.bin/mg/cscope.c')
-rw-r--r--usr.bin/mg/cscope.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/mg/cscope.c b/usr.bin/mg/cscope.c
index 9a8db5e413d..1dc9f901909 100644
--- a/usr.bin/mg/cscope.c
+++ b/usr.bin/mg/cscope.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cscope.c,v 1.3 2012/07/02 08:08:31 lum Exp $ */
+/* $OpenBSD: cscope.c,v 1.4 2014/01/22 09:43:53 jsg Exp $ */
/*
* This file is in the public domain.
@@ -200,8 +200,10 @@ cscreatelist(int f, int n)
}
bp = bfind("*cscope*", TRUE);
- if (bclear(bp) != TRUE)
+ if (bclear(bp) != TRUE) {
+ pclose(fpipe);
return (FALSE);
+ }
bp->b_flag |= BFREADONLY;
clen = snprintf(title, sizeof(title), "%s%s",
@@ -413,8 +415,10 @@ do_cscope(int i)
}
bp = bfind("*cscope*", TRUE);
- if (bclear(bp) != TRUE)
+ if (bclear(bp) != TRUE) {
+ pclose(fpipe);
return (FALSE);
+ }
bp->b_flag |= BFREADONLY;
clen = snprintf(title, sizeof(title), "%s%s", csprompt[i], pattern);