Do defensive programming by using zfree() to initialize freed pointers
to NULL, so that eventual use after free result in a NULL pointer deref
instead of more subtle behaviour.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
if (strcmp(print_state->last_topic, topic ?: "")) {
if (topic)
printf("\n%s:\n", topic);
- free(print_state->last_topic);
+ zfree(&print_state->last_topic);
print_state->last_topic = strdup(topic ?: "");
}
else
printf("%s\n", group);
}
- free(print_state->last_metricgroups);
+ zfree(&print_state->last_metricgroups);
print_state->last_metricgroups = strdup(group ?: "");
}
if (!print_state->metrics)