From 7e8dfdf113000b76207e8b56e9bcf96d6044759a Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Tue, 17 Feb 2015 23:20:19 +0000 Subject: [PATCH] ministat(1): replace malloc + memset with calloc. Reviewed by: phk --- usr.bin/ministat/ministat.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/usr.bin/ministat/ministat.c b/usr.bin/ministat/ministat.c index c8d8e12355c9..4c0ddd056a64 100644 --- a/usr.bin/ministat/ministat.c +++ b/usr.bin/ministat/ministat.c @@ -329,10 +329,8 @@ PlotSet(struct dataset *ds, int val) else bar = 0; - if (pl->bar == NULL) { - pl->bar = malloc(sizeof(char *) * pl->num_datasets); - memset(pl->bar, 0, sizeof(char*) * pl->num_datasets); - } + if (pl->bar == NULL) + pl->bar = calloc(sizeof(char *), pl->num_datasets); if (pl->bar[bar] == NULL) { pl->bar[bar] = malloc(pl->width); memset(pl->bar[bar], 0, pl->width);