pivot-table: Fix incorrect allocation count in pivot_table_dump().
authorBen Pfaff <blp@cs.stanford.edu>
Wed, 30 Dec 2020 20:28:56 +0000 (12:28 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 30 Dec 2020 20:29:24 +0000 (12:29 -0800)
src/output/pivot-table.c

index a0c4836d4181fdd116dd627b2bdf51a4eeb541df..d3f2c4d041de494d2f01305c5c122a599a769864 100644 (file)
@@ -1678,8 +1678,7 @@ pivot_table_dump (const struct pivot_table *table, int indentation)
           pivot_value_dump (d->root->name);
           fputs (" =", stdout);
 
-          struct pivot_value **names = xnmalloc (layer_axis->label_depth,
-                                                 sizeof *names);
+          struct pivot_value **names = xnmalloc (d->n_leaves, sizeof *names);
           size_t n_names = 0;
           for (const struct pivot_category *c
                  = d->presentation_leaves[layer_indexes[i]];