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 <jglisse@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Marek Olšák 2012-02-21 18:40:11 +01:00
parent 6a94c9dde0
commit 99d5c1a13b

View file

@ -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);