← Commit list

3a1d8377a

Eric Andersen
Eric Andersen
2002-09-20
FAILED Duration: 6s

Subject

don't leak FILEs

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

procps/top.c+3 -0
@@ -212,6 +212,8 @@ static void read_status(int num, status_t *s)
fp = fopen(status, "r");
if (!fp) {
strncpy(s->pid, "EXIT", sizeof(s->pid));
+ s->pid[sizeof(s->pid)-1] = '\0';
+ fclose(fp);
continue;
}
@@ -296,6 +298,7 @@ static status_t *read_info(int num, struct dirent **namelist)
sprintf(cmdline, "%s/cmdline", s->pid);
fp = fopen(cmdline, "r");
if (!fp) {
+ fclose(fp);
perror("fopen('cmdline')");
return NULL;
}