diff options
author | Eric Andersen | 2002-09-20 07:33:18 +0000 |
---|---|---|
committer | Eric Andersen | 2002-09-20 07:33:18 +0000 |
commit | 3a1d8377ab4b17f110831d324cbd612b09fb40f8 (patch) | |
tree | 8e27126a6de30c50aac69c08fc3ded7215f162a5 /procps | |
parent | 19feada06f0428dba579e2cf6d7e48b9ddc80de1 (diff) | |
download | busybox-3a1d8377ab4b17f110831d324cbd612b09fb40f8.zip busybox-3a1d8377ab4b17f110831d324cbd612b09fb40f8.tar.gz |
don't leak FILEs
Diffstat (limited to 'procps')
-rw-r--r-- | procps/top.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/procps/top.c b/procps/top.c index 8e5767e..f6bbb23 100644 --- a/procps/top.c +++ b/procps/top.c @@ -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; } |