From: Jens Axboe Date: Tue, 3 May 2016 14:34:50 +0000 (-0600) Subject: btt/unplug_hist: fix bad memset X-Git-Tag: blktrace-1.2.0~16 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=d1422556dbff03e982aeb2faf5893b4363621bee;p=blktrace.git btt/unplug_hist: fix bad memset Just replace the malloc/memset with a calloc(). Signed-off-by: Jens Axboe --- diff --git a/btt/unplug_hist.c b/btt/unplug_hist.c index 89995de..be16b69 100644 --- a/btt/unplug_hist.c +++ b/btt/unplug_hist.c @@ -34,11 +34,11 @@ void *unplug_hist_alloc(struct d_info *dip) { struct hist_bkt *hbp; - if (unplug_hist_name == NULL) return NULL; + if (unplug_hist_name == NULL) + return NULL; - hbp = malloc(sizeof(*hbp)); + hbp = calloc(1, sizeof(*hbp)); hbp->dip = dip; - memset(hbp->hist, 0, NBKTS * sizeof(int)); return hbp; }