Fixed memory leak
authorJason Stover <jhs@math.gcsu.edu>
Sat, 25 Mar 2006 22:46:21 +0000 (22:46 +0000)
committerJason Stover <jhs@math.gcsu.edu>
Sat, 25 Mar 2006 22:46:21 +0000 (22:46 +0000)
src/data/category.c

index 55d7ca8b05addbe392424f1114755d9e4629645d..509085497ab01fb39f6a6d0f5b4bce7f102a8984 100644 (file)
@@ -59,9 +59,16 @@ void
 cat_stored_values_destroy (struct variable *v)
 {
   assert (v != NULL);
+
   if (v->obs_vals != NULL)
     {
+      if (v->obs_vals->n_allocated_categories > 0)
+       {
+         free (v->obs_vals->vals);
+         v->obs_vals->vals = NULL;
+       }
       free (v->obs_vals);
+      v->obs_vals = NULL;
     }
 }