ctables_summary_spec_set_clone (struct ctables_summary_spec_set *dst,
const struct ctables_summary_spec_set *src)
{
- struct ctables_summary_spec *specs = xnmalloc (src->n, sizeof *specs);
+ struct ctables_summary_spec *specs
+ = (src->n ? xnmalloc (src->n, sizeof *specs) : NULL);
for (size_t i = 0; i < src->n; i++)
ctables_summary_spec_clone (&specs[i], &src->specs[i]);
ctables_axis_destroy (t->axes[a]);
ctables_stack_uninit (&t->stacks[a]);
}
+ free (t->summary_specs.specs);
struct ctables_value *ctv, *next_ctv;
HMAP_FOR_EACH_SAFE (ctv, next_ctv, struct ctables_value, node,
if (!ct)
return;
+ struct ctables_postcompute *pc, *next_pc;
+ HMAP_FOR_EACH_SAFE (pc, next_pc, struct ctables_postcompute, hmap_node,
+ &ct->postcomputes)
+ {
+ free (pc->name);
+ msg_location_destroy (pc->location);
+ ctables_pcexpr_destroy (pc->expr);
+ free (pc->label);
+ if (pc->specs)
+ {
+ ctables_summary_spec_set_uninit (pc->specs);
+ free (pc->specs);
+ }
+ hmap_delete (&ct->postcomputes, &pc->hmap_node);
+ free (pc);
+ }
+
fmt_settings_uninit (&ct->ctables_formats);
pivot_table_look_unref (ct->look);
free (ct->zero);
static void
ctables_nest_uninit (struct ctables_nest *nest)
{
- if (nest)
- free (nest->vars);
+ free (nest->vars);
+ for (enum ctables_summary_variant sv = 0; sv < N_CSVS; sv++)
+ ctables_summary_spec_set_uninit (&nest->specs[sv]);
}
static void
j++;
}
}
+ free (items);
#if 0
for (size_t j = 0; j < merged->n; j++)
for (enum pivot_axis_type a = 0; a < PIVOT_N_AXES; a++)
{
- for (size_t i = 0; i < s->nests[a]->n; i++)
+ struct ctables_nest *nest = s->nests[a];
+ for (size_t i = 0; i < nest->n; i++)
hmap_destroy (&s->occurrences[a][i]);
free (s->occurrences[a]);
+ for (enum ctables_domain_type dt = 0; dt < N_CTDTS; dt++)
+ {
+ free (nest->domains[dt]);
+ nest->domains[dt] = NULL;
+ }
}
hmap_destroy (&s->cells);