From 47bb96f9a99341df405f7ff20ffb9bc987381c36 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 31 Dec 2020 22:13:59 -0800 Subject: [PATCH] pivot-table: Don't rely on xcalloc (0, x) returning nonnull. I believe that glibc and gnulib ensure this, but I would rather not rely on that. --- src/output/pivot-table.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/output/pivot-table.c b/src/output/pivot-table.c index b185d3ea8a..c255ea83b0 100644 --- a/src/output/pivot-table.c +++ b/src/output/pivot-table.c @@ -370,7 +370,8 @@ pivot_axis_iterator_next (size_t *indexes, const struct pivot_axis *axis) if (axis->dimensions[i]->n_leaves == 0) return NULL; - return xcalloc (axis->n_dimensions, sizeof *indexes); + size_t size = axis->n_dimensions * sizeof *indexes; + return xzalloc (MAX (size, 1)); } for (size_t i = 0; i < axis->n_dimensions; i++) -- 2.30.2