From 2404b2c3198270040d17f32271cc9a812a61b7bc Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Sun, 8 Apr 2018 15:42:50 -0600 Subject: [PATCH] axmap: use calloc() for level alloc We rely on it being set to NULL for error handling. Signed-off-by: Jens Axboe --- lib/axmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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++) { -- 2.25.1