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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user