aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-09-20 07:33:18 +0000
committerEric Andersen <andersen@codepoet.org>2002-09-20 07:33:18 +0000
commit3a1d8377ab4b17f110831d324cbd612b09fb40f8 (patch)
tree8e27126a6de30c50aac69c08fc3ded7215f162a5
parent19feada06f0428dba579e2cf6d7e48b9ddc80de1 (diff)
downloadbusybox-w32-3a1d8377ab4b17f110831d324cbd612b09fb40f8.tar.gz
busybox-w32-3a1d8377ab4b17f110831d324cbd612b09fb40f8.tar.bz2
busybox-w32-3a1d8377ab4b17f110831d324cbd612b09fb40f8.zip
don't leak FILEs
-rw-r--r--procps/top.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/procps/top.c b/procps/top.c
index 8e5767e41..f6bbb23cd 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -212,6 +212,8 @@ static void read_status(int num, status_t *s)
212 fp = fopen(status, "r"); 212 fp = fopen(status, "r");
213 if (!fp) { 213 if (!fp) {
214 strncpy(s->pid, "EXIT", sizeof(s->pid)); 214 strncpy(s->pid, "EXIT", sizeof(s->pid));
215 s->pid[sizeof(s->pid)-1] = '\0';
216 fclose(fp);
215 continue; 217 continue;
216 } 218 }
217 219
@@ -296,6 +298,7 @@ static status_t *read_info(int num, struct dirent **namelist)
296 sprintf(cmdline, "%s/cmdline", s->pid); 298 sprintf(cmdline, "%s/cmdline", s->pid);
297 fp = fopen(cmdline, "r"); 299 fp = fopen(cmdline, "r");
298 if (!fp) { 300 if (!fp) {
301 fclose(fp);
299 perror("fopen('cmdline')"); 302 perror("fopen('cmdline')");
300 return NULL; 303 return NULL;
301 } 304 }