[Mesa-dev] [PATCH] gallium/util: change assertion to conditional in util_bitmask_destroy()

Jose Fonseca jfonseca at vmware.com
Tue May 3 21:30:55 UTC 2016


On 03/05/16 22:10, Brian Paul wrote:
> 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.
> ---
>   src/gallium/auxiliary/util/u_bitmask.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/auxiliary/util/u_bitmask.c b/src/gallium/auxiliary/util/u_bitmask.c
> index c22f506..b15dfd8 100644
> --- a/src/gallium/auxiliary/util/u_bitmask.c
> +++ b/src/gallium/auxiliary/util/u_bitmask.c
> @@ -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);
> +   }
>   }
>
>

Looks good.

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>


More information about the mesa-dev mailing list