diff lib/bitsetv.c @ 40159:069b50a66104

bitsetv: allow free on NULL. * lib/bitsetv.c (bitsetv_free): Do nothing when the bitsetv is NULL.
author Akim Demaille <akim.demaille@gmail.com>
date Sun, 27 Jan 2019 18:49:36 +0100
parents b5d7b6ac3542
children
line wrap: on
line diff
--- a/lib/bitsetv.c	Sun Jan 27 16:55:27 2019 +0100
+++ b/lib/bitsetv.c	Sun Jan 27 18:49:36 2019 +0100
@@ -71,9 +71,12 @@
 void
 bitsetv_free (bitsetv bsetv)
 {
-  for (bitset_bindex i = 0; bsetv[i]; i++)
-    BITSET_FREE_ (bsetv[i]);
-  free (bsetv);
+  if (bsetv)
+    {
+      for (bitset_bindex i = 0; bsetv[i]; i++)
+        BITSET_FREE_ (bsetv[i]);
+      free (bsetv);
+    }
 }