gallium/util: change assertion to conditional in util_bitmask_destroy()
authorBrian Paul <brianp@vmware.com>
Tue, 3 May 2016 21:07:56 +0000 (15:07 -0600)
committerBrian Paul <brianp@vmware.com>
Tue, 3 May 2016 21:40:49 +0000 (15:40 -0600)
If we fail to create a context in the VMware driver we call this function
unconditionally to free a bunch of bit vectors.  Instead of asserting on
a null pointer, just no-op.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/util/u_bitmask.c

index c22f50689239f4a385f0c4e7412de11d01541885..b15dfd8d678ee04d2cd6af96fe77ffa0f3cd0864 100644 (file)
@@ -320,9 +320,9 @@ util_bitmask_get_first_index(struct util_bitmask *bm)
 void
 util_bitmask_destroy(struct util_bitmask *bm)
 {
-   assert(bm);
-
-   FREE(bm->words);
-   FREE(bm);
+   if (bm) {
+      FREE(bm->words);
+      FREE(bm);
+   }
 }