From: Marek Olšák <[email protected]>

---
 src/util/slab.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util/slab.c b/src/util/slab.c
index 4264814..4ce0e9a 100644
--- a/src/util/slab.c
+++ b/src/util/slab.c
@@ -133,20 +133,23 @@ void slab_create_child(struct slab_child_pool *pool,
 }
 
 /**
  * Destroy the child pool.
  *
  * Pages associated to the pool will be orphaned. They are eventually freed
  * when all objects in them are freed.
  */
 void slab_destroy_child(struct slab_child_pool *pool)
 {
+   if (!pool->parent)
+      return; /* the slab probably wasn't even created */
+
    mtx_lock(&pool->parent->mutex);
 
    while (pool->pages) {
       struct slab_page_header *page = pool->pages;
       pool->pages = page->u.next;
       p_atomic_set(&page->u.num_remaining, pool->parent->num_elements);
 
       for (unsigned i = 0; i < pool->parent->num_elements; ++i) {
          struct slab_element_header *elt = slab_get_element(pool->parent, 
page, i);
          p_atomic_set(&elt->owner, (intptr_t)page | 1);
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to