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).
This commit is contained in:
parent
da8e209f33
commit
cb8266e797
@ -1796,6 +1796,10 @@ process_file(char *filename)
|
|||||||
|
|
||||||
if (filename == NULL) {
|
if (filename == NULL) {
|
||||||
io = my_popen(command, "r", &pid_of_command);
|
io = my_popen(command, "r", &pid_of_command);
|
||||||
|
if (io == NULL) {
|
||||||
|
printf("Can't popen the command %s\n", command);
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
io = fopen(filename, "r");
|
io = fopen(filename, "r");
|
||||||
if (io == NULL) {
|
if (io == NULL) {
|
||||||
@ -1808,8 +1812,10 @@ process_file(char *filename)
|
|||||||
if (cnts == NULL) {
|
if (cnts == NULL) {
|
||||||
/* Nothing we can do */
|
/* Nothing we can do */
|
||||||
printf("Nothing to do -- no counters built\n");
|
printf("Nothing to do -- no counters built\n");
|
||||||
if (io) {
|
if (filename) {
|
||||||
fclose(io);
|
fclose(io);
|
||||||
|
} else {
|
||||||
|
my_pclose(io, pid_of_command);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user