summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorcem <cem@FreeBSD.org>2016-05-10 20:09:40 +0000
committercem <cem@FreeBSD.org>2016-05-10 20:09:40 +0000
commit0a07aade4208a50204fdd7f0cc4d391b49aff9a5 (patch)
tree56aed442d9b34c3ee81fce995e670ddfd12acad4 /usr.bin
parentb05aea41fa236129a4433cc26855c0a8304c3453 (diff)
downloadFreeBSD-src-0a07aade4208a50204fdd7f0cc4d391b49aff9a5.zip
FreeBSD-src-0a07aade4208a50204fdd7f0cc4d391b49aff9a5.tar.gz
sdiff(1): Fix potential NULL deref in cleanup path
In the presence of the --diff-pid argument, it is possible for 'diffpipe' to be NULL. Only fclose() it if it was initialized. Reported by: Coverity CID: 1355183 Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/sdiff/sdiff.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/sdiff/sdiff.c b/usr.bin/sdiff/sdiff.c
index b9facfe..008de53 100644
--- a/usr.bin/sdiff/sdiff.c
+++ b/usr.bin/sdiff/sdiff.c
@@ -430,7 +430,8 @@ main(int argc, char **argv)
/* Close open files and pipe, delete temps */
fclose(file1);
fclose(file2);
- fclose(diffpipe);
+ if (diffpipe != NULL)
+ fclose(diffpipe);
if (tmp1)
if (unlink(tmp1))
warn("Error deleting %s.", tmp1);
OpenPOWER on IntegriCloud