2007-04-22 Ben Pfaff <blp@gnu.org>
+ * dictionary.c (dict_set_split_vars): dict_destroy expects that
+ dict_clear will free most data related to the dictionary.
+ dict_clear does a decent job, except that dict_set_split_vars on
+ some systems won't actually free the dict's "split" member.
+ Instead, it'll allocate a 1-byte region. Fix this.
+
* value.c (value_copy): New function.
(value_set_missing): Ditto.
/* Deletes variable V from dictionary D and frees V.
This is a very bad idea if there might be any pointers to V
- from outside D. In general, no variable in should be deleted when
- any transformations are active on the dictionary's dataset, because
- those transformations might reference the deleted variable.
- The safest time to delete a variable is just after a procedure
- has been executed, as done by MODIFY VARS.
+ from outside D. In general, no variable in the active file's
+ dictionary should be deleted when any transformations are
+ active on the dictionary's dataset, because those
+ transformations might reference the deleted variable. The
+ safest time to delete a variable is just after a procedure has
+ been executed, as done by MODIFY VARS.
Pointers to V within D are not a problem, because
dict_delete_var() knows to remove V from split variables,
assert (cnt == 0 || split != NULL);
d->split_cnt = cnt;
- d->split = xnrealloc (d->split, cnt, sizeof *d->split);
+ d->split = cnt > 0 ? xnrealloc (d->split, cnt, sizeof *d->split) : NULL;
memcpy (d->split, split, cnt * sizeof *d->split);
if ( d->callbacks && d->callbacks->split_changed )