summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2015-01-27 18:56:22 +0000
committerrrs <rrs@FreeBSD.org>2015-01-27 18:56:22 +0000
commit0f98db1b3f12612b0dce2b07750691abddd6e6ad (patch)
tree5d8c137168764e5aaf7a0a6d502e02acd021171f /usr.sbin
parentc87fb0e541983ab5553aa3341d5a392dcb8a322f (diff)
downloadFreeBSD-src-0f98db1b3f12612b0dce2b07750691abddd6e6ad.zip
FreeBSD-src-0f98db1b3f12612b0dce2b07750691abddd6e6ad.tar.gz
Fix yet another coverty warning (missing io is NULL check) and in examining that
warning I see yet another issue where we should be pclosing the io in the event of the error and its a command (not fclose only).
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pmcstudy/pmcstudy.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/pmcstudy/pmcstudy.c b/usr.sbin/pmcstudy/pmcstudy.c
index a99d59a..a7ec371 100644
--- a/usr.sbin/pmcstudy/pmcstudy.c
+++ b/usr.sbin/pmcstudy/pmcstudy.c
@@ -1796,6 +1796,10 @@ process_file(char *filename)
if (filename == NULL) {
io = my_popen(command, "r", &pid_of_command);
+ if (io == NULL) {
+ printf("Can't popen the command %s\n", command);
+ return;
+ }
} else {
io = fopen(filename, "r");
if (io == NULL) {
@@ -1808,8 +1812,10 @@ process_file(char *filename)
if (cnts == NULL) {
/* Nothing we can do */
printf("Nothing to do -- no counters built\n");
- if (io) {
- fclose(io);
+ if (filename) {
+ fclose(io);
+ } else {
+ my_pclose(io, pid_of_command);
}
return;
}
OpenPOWER on IntegriCloud