mirror of
https://github.com/sheumann/hush.git
synced 2024-12-21 23:29:34 +00:00
don't leak FILEs
This commit is contained in:
parent
19feada06f
commit
3a1d8377ab
@ -212,6 +212,8 @@ static void read_status(int num, status_t *s)
|
|||||||
fp = fopen(status, "r");
|
fp = fopen(status, "r");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
strncpy(s->pid, "EXIT", sizeof(s->pid));
|
strncpy(s->pid, "EXIT", sizeof(s->pid));
|
||||||
|
s->pid[sizeof(s->pid)-1] = '\0';
|
||||||
|
fclose(fp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,6 +298,7 @@ static status_t *read_info(int num, struct dirent **namelist)
|
|||||||
sprintf(cmdline, "%s/cmdline", s->pid);
|
sprintf(cmdline, "%s/cmdline", s->pid);
|
||||||
fp = fopen(cmdline, "r");
|
fp = fopen(cmdline, "r");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
|
fclose(fp);
|
||||||
perror("fopen('cmdline')");
|
perror("fopen('cmdline')");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user