summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2012-02-21 18:40:11 +0100
committerMarek Olšák <maraeo@gmail.com>2012-02-23 20:29:55 +0100
commit99d5c1a13b97b9133a166c00c9fba1bec5f4bd9e (patch)
tree45aae5ba629e0743ee8ee5d87ea42ff1f123f503
parent6a94c9dde0d62b5ccfcbe3dbafdadeab37fd48a6 (diff)
downloadexternal_mesa3d-99d5c1a13b97b9133a166c00c9fba1bec5f4bd9e.zip
external_mesa3d-99d5c1a13b97b9133a166c00c9fba1bec5f4bd9e.tar.gz
external_mesa3d-99d5c1a13b97b9133a166c00c9fba1bec5f4bd9e.tar.bz2
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>
-rw-r--r--src/gallium/auxiliary/util/u_slab.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/util/u_slab.c b/src/gallium/auxiliary/util/u_slab.c
index 21bf2d7..f9f5ef6 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);