Set categoricals to NULL in one-pass covariance; avoid freeing NULL in categoricals_d...
[pspp-builds.git] / src / math / categoricals.c
index 6002d8c179aa09529fa7740a676ab7329f2255fa..33e3b51c62f99cc2290ce7918dbba6aedb111878 100644 (file)
@@ -91,11 +91,14 @@ void
 categoricals_destroy ( struct categoricals *cat)
 {
   int i;
-  for (i = 0 ; i < cat->n_vp; ++i)
-    hmap_destroy (&cat->vp[i].map);
-
-  pool_destroy (cat->pool);
-  free (cat);
+  if (cat != NULL)
+    {
+      for (i = 0 ; i < cat->n_vp; ++i)
+       hmap_destroy (&cat->vp[i].map);
+      
+      pool_destroy (cat->pool);
+      free (cat);
+    }
 }