projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
pivot-table: Properly allocate pivot_table's current_layer.
[pspp]
/
src
/
output
/
pivot-table.c
diff --git
a/src/output/pivot-table.c
b/src/output/pivot-table.c
index 674fe2cdf5c6b80babb44bd7619fb866eb1420ff..092ebfc53a9564da3d9488a3972a87231ce8f527 100644
(file)
--- a/
src/output/pivot-table.c
+++ b/
src/output/pivot-table.c
@@
-279,6
+279,13
@@
pivot_dimension_create__ (struct pivot_table *table,
axis->dimensions, (axis->n_dimensions + 1) * sizeof *axis->dimensions);
axis->dimensions[axis->n_dimensions++] = d;
axis->dimensions, (axis->n_dimensions + 1) * sizeof *axis->dimensions);
axis->dimensions[axis->n_dimensions++] = d;
+ if (axis_type == PIVOT_AXIS_LAYER)
+ {
+ free (table->current_layer);
+ table->current_layer = xcalloc (axis[PIVOT_AXIS_LAYER].n_dimensions,
+ sizeof *table->current_layer);
+ }
+
/* XXX extent and label_depth need to be calculated later. */
return d;
/* XXX extent and label_depth need to be calculated later. */
return d;
@@
-293,6
+300,7
@@
pivot_dimension_destroy (struct pivot_dimension *d)
pivot_category_destroy (d->root);
free (d->data_leaves);
free (d->presentation_leaves);
pivot_category_destroy (d->root);
free (d->data_leaves);
free (d->presentation_leaves);
+ free (d);
}
/* Returns the first leaf node in an in-order traversal that is a child of
}
/* Returns the first leaf node in an in-order traversal that is a child of
@@
-505,6
+513,7
@@
pivot_category_destroy (struct pivot_category *c)
pivot_value_destroy (c->name);
for (size_t i = 0; i < c->n_subs; i++)
pivot_category_destroy (c->subs[i]);
pivot_value_destroy (c->name);
for (size_t i = 0; i < c->n_subs; i++)
pivot_category_destroy (c->subs[i]);
+ free (c->subs);
free (c);
}
\f
free (c);
}
\f
@@
-1789,8
+1798,8
@@
pivot_value_destroy (struct pivot_value *value)
font_style_uninit (value->font_style);
free (value->font_style);
free (value->cell_style);
font_style_uninit (value->font_style);
free (value->font_style);
free (value->cell_style);
- for (size_t i = 0; i < value->n_footnotes; i++)
- pivot_footnote_destroy (value->footnotes[i]);
+ /* Do not free the elements of footnotes because VALUE does not own
+ them. */
free (value->footnotes);
switch (value->type)
free (value->footnotes);
switch (value->type)
@@
-1800,7
+1809,8
@@
pivot_value_destroy (struct pivot_value *value)
free (value->numeric.value_label);
break;
free (value->numeric.value_label);
break;
- case SETTINGS_VALUE_SHOW_VALUE:
+ case PIVOT_VALUE_STRING:
+ free (value->string.s);
free (value->string.var_name);
free (value->string.value_label);
break;
free (value->string.var_name);
free (value->string.value_label);
break;