diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2014-04-10 14:03:58 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2014-04-10 14:03:58 +0000 |
commit | c85ffeff9dce2cd8b77c4c66568e4777be91ac07 (patch) | |
tree | cd60304b9cb2595d27f922fc81a74ed5fce73234 /usr.bin | |
parent | 231207b6b5a2535ce16e7ea916bc759d10a242ce (diff) |
fix fd leaks in error paths missed last time around
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mg/cscope.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/mg/cscope.c b/usr.bin/mg/cscope.c index b3de0182559..0deada3475c 100644 --- a/usr.bin/mg/cscope.c +++ b/usr.bin/mg/cscope.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cscope.c,v 1.5 2014/03/20 07:47:29 lum Exp $ */ +/* $OpenBSD: cscope.c,v 1.6 2014/04/10 14:03:57 jsg Exp $ */ /* * This file is in the public domain. @@ -212,8 +212,10 @@ cscreatelist(int f, int n) clen = snprintf(title, sizeof(title), "%s%s", "Creating cscope file list 'cscope.files' in: ", dir); - if (clen < 0 || clen >= sizeof(title)) + if (clen < 0 || clen >= sizeof(title)) { + pclose(fpipe); return (FALSE); + } addline(bp, title); addline(bp, ""); /* All lines are NUL terminated */ @@ -436,8 +438,10 @@ do_cscope(int i) bp->b_flag |= BFREADONLY; clen = snprintf(title, sizeof(title), "%s%s", csprompt[i], pattern); - if (clen < 0 || clen >= sizeof(title)) + if (clen < 0 || clen >= sizeof(title)) { + pclose(fpipe); return (FALSE); + } addline(bp, title); addline(bp, ""); addline(bp, "-------------------------------------------------------------------------------"); |