btt/unplug_hist: fix bad memset
authorJens Axboe <axboe@fb.com>
Tue, 3 May 2016 14:34:50 +0000 (08:34 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 3 May 2016 14:34:50 +0000 (08:34 -0600)
Just replace the malloc/memset with a calloc().

Signed-off-by: Jens Axboe <axboe@fb.com>
btt/unplug_hist.c

index 89995ded5297b15c421ca4c6bfec9446d447675b..be16b69c753c46d7c3bbbc4dd26c97f141c193b7 100644 (file)
@@ -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;
 }