diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/cbmem/cbmem.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c index 3c7f49b880..d8c6145732 100644 --- a/util/cbmem/cbmem.c +++ b/util/cbmem/cbmem.c @@ -685,7 +685,7 @@ static void dump_console(void) */ if (size > cursor) size = cursor; - console_c = malloc(size + 1); + console_c = calloc(1, size + 1); unmap_memory(); if (!console_c) { fprintf(stderr, "Not enough memory for console.\n"); @@ -695,8 +695,6 @@ static void dump_console(void) console_p = map_memory_size((unsigned long)console.cbmem_addr, size + sizeof(size) + sizeof(cursor), 1); memcpy(console_c, console_p + 8, size); - console_c[size] = 0; - console_c[cursor] = 0; printf("%s\n", console_c); if (size < cursor) |