From: Jens Axboe Date: Sun, 8 Apr 2018 21:42:50 +0000 (-0600) Subject: axmap: use calloc() for level alloc X-Git-Tag: fio-3.6~14 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=2404b2c3198270040d17f32271cc9a812a61b7bc;p=fio.git axmap: use calloc() for level alloc We rely on it being set to NULL for error handling. Signed-off-by: Jens Axboe --- diff --git a/lib/axmap.c b/lib/axmap.c index bf203dfe..3c65308c 100644 --- a/lib/axmap.c +++ b/lib/axmap.c @@ -102,7 +102,7 @@ struct axmap *axmap_new(unsigned long nr_bits) } axmap->nr_levels = levels; - axmap->levels = malloc(axmap->nr_levels * sizeof(struct axmap_level)); + axmap->levels = calloc(axmap->nr_levels, sizeof(struct axmap_level)); axmap->nr_bits = nr_bits; for (i = 0; i < axmap->nr_levels; i++) {