top: fix memset length (sizeof(ptr) vs sizeof(array) problem)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2014-07-29 17:00:30 +02:00
parent 7df1f1dda1
commit 6c6d37ee45

View File

@ -536,7 +536,7 @@ static void parse_meminfo(unsigned long meminfo[MI_MAX])
FILE *f; FILE *f;
int i; int i;
memset(meminfo, 0, sizeof(meminfo)); memset(meminfo, 0, sizeof(meminfo[0]) * MI_MAX);
f = xfopen_for_read("meminfo"); f = xfopen_for_read("meminfo");
while (fgets(buf, sizeof(buf), f) != NULL) { while (fgets(buf, sizeof(buf), f) != NULL) {
char *c = strchr(buf, ':'); char *c = strchr(buf, ':');
@ -550,7 +550,6 @@ static void parse_meminfo(unsigned long meminfo[MI_MAX])
fclose(f); fclose(f);
} }
static unsigned long display_header(int scr_width, int *lines_rem_p) static unsigned long display_header(int scr_width, int *lines_rem_p)
{ {
char scrbuf[100]; /* [80] was a bit too low on 8Gb ram box */ char scrbuf[100]; /* [80] was a bit too low on 8Gb ram box */