segment: Refine treatment of start of macro body.
[pspp] / src / math / categoricals.c
index 30c4c567ce607bc1baaeaceeab599c86ba2fd1f5..4e6d8dad7ad942c633c7dc79820b93bc43d01ea6 100644 (file)
@@ -276,6 +276,7 @@ categoricals_destroy (struct categoricals *cat)
       free (cat->iap[i].enc_sum);
       hmap_destroy (&cat->iap[i].ivmap);
     }
+  free (cat->iap);
 
   /* Interate over each variable and delete its value map.
 
@@ -382,7 +383,7 @@ categoricals_update (struct categoricals *cat, const struct ccase *c)
         {
           valn = pool_malloc (cat->pool, sizeof *valn);
           valn->index = -1;
-          value_init (&valn->val, width);
+          value_init_pool (cat->pool, &valn->val, width);
           value_copy (&valn->val, val, width);
           hmap_insert (&vn->valmap, &valn->node, hash);
         }
@@ -479,7 +480,7 @@ categoricals_done (const struct categoricals *cat_)
           return;
         }
 
-      struct value_node **nodes = xcalloc (sizeof *nodes, n_vals);
+      struct value_node **nodes = XCALLOC (n_vals,  struct value_node *);
       int x = 0;
       struct value_node *valnd;
       HMAP_FOR_EACH (valnd, struct value_node, node, &vn->valmap)