From: Marek Olšák Date: Tue, 21 Feb 2012 17:40:11 +0000 (+0100) Subject: gallium/u_slab: fix possible crash in util_slab_destroy X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=99d5c1a13b97b9133a166c00c9fba1bec5f4bd9e;p=mesa.git gallium/u_slab: fix possible crash in util_slab_destroy It may happen if util_slab_create has not been called. Reviewed-by: Jerome Glisse Reviewed-by: Alex Deucher --- diff --git a/src/gallium/auxiliary/util/u_slab.c b/src/gallium/auxiliary/util/u_slab.c index 21bf2d735ac..f9f5ef68f3a 100644 --- a/src/gallium/auxiliary/util/u_slab.c +++ b/src/gallium/auxiliary/util/u_slab.c @@ -160,9 +160,11 @@ void util_slab_destroy(struct util_slab_mempool *pool) { struct util_slab_page *page, *temp; - foreach_s(page, temp, &pool->list) { - remove_from_list(page); - FREE(page); + if (pool->list.next) { + foreach_s(page, temp, &pool->list) { + remove_from_list(page); + FREE(page); + } } pipe_mutex_destroy(pool->mutex);