projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
19feada
)
don't leak FILEs
author
Eric Andersen
<andersen@codepoet.org>
Fri, 20 Sep 2002 07:33:18 +0000
(07:33 -0000)
committer
Eric Andersen
<andersen@codepoet.org>
Fri, 20 Sep 2002 07:33:18 +0000
(07:33 -0000)
procps/top.c
patch
|
blob
|
history
diff --git
a/procps/top.c
b/procps/top.c
index 8e5767e4105dbc0487a3f8b4400fe1ed5ef295c7..f6bbb23cdc9ab99149c85fd6cb5af509150c09ff 100644
(file)
--- 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;
}