add is_init check to malloc_info

pull/121/head
Daniel Micay 2020-09-17 16:07:10 -04:00
parent 9fb2791af2
commit 50e0f1334c
1 changed files with 35 additions and 32 deletions

View File

@ -1800,6 +1800,8 @@ EXPORT int h_malloc_info(int options, UNUSED FILE *fp) {
#if CONFIG_STATS
fputs("<malloc version=\"hardened_malloc-1\">", fp);
if (is_init()) {
for (unsigned arena = 0; arena < N_ARENA; arena++) {
fprintf(fp, "<heap nr=\"%u\">", arena);
@ -1841,6 +1843,7 @@ EXPORT int h_malloc_info(int options, UNUSED FILE *fp) {
fprintf(fp, "<heap nr=\"%u\">", N_ARENA);
fprintf(fp, "<allocated_large>%zu</allocated_large>", region_allocated);
fputs("</heap>", fp);
}
fputs("</malloc>", fp);