From: Ben Pfaff Date: Fri, 1 Jan 2021 06:13:59 +0000 (-0800) Subject: pivot-table: Don't rely on xcalloc (0, x) returning nonnull. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47bb96f9a99341df405f7ff20ffb9bc987381c36;p=pspp 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. --- 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++)