projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2dbe538
)
pivot-table: Don't rely on xcalloc (0, x) returning nonnull.
author
Ben Pfaff
<blp@cs.stanford.edu>
Fri, 1 Jan 2021 06:13:59 +0000
(22:13 -0800)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 2 Jan 2021 03:23:40 +0000
(19:23 -0800)
I believe that glibc and gnulib ensure this, but I would rather not rely
on that.
src/output/pivot-table.c
patch
|
blob
|
history
diff --git
a/src/output/pivot-table.c
b/src/output/pivot-table.c
index b185d3ea8ac4c9ff8440cb5bc4561ed096f47a7c..c255ea83b0b6a4880f26c9abb854f66b9a859d96 100644
(file)
--- 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++)