diff --git a/src/util/slab.c b/src/util/slab.c index 62634034fdc..b0f07e0202d 100644 --- a/src/util/slab.c +++ b/src/util/slab.c @@ -257,7 +257,8 @@ void slab_free(struct slab_child_pool *pool, void *ptr) } /* The slow case: migration or an orphaned page. */ - mtx_lock(&pool->parent->mutex); + if (pool->parent) + mtx_lock(&pool->parent->mutex); /* Note: we _must_ re-read elt->owner here because the owning child pool * may have been destroyed by another thread in the meantime. @@ -268,9 +269,11 @@ void slab_free(struct slab_child_pool *pool, void *ptr) struct slab_child_pool *owner = (struct slab_child_pool *)owner_int; elt->next = owner->migrated; owner->migrated = elt; - mtx_unlock(&pool->parent->mutex); + if (pool->parent) + mtx_unlock(&pool->parent->mutex); } else { - mtx_unlock(&pool->parent->mutex); + if (pool->parent) + mtx_unlock(&pool->parent->mutex); slab_free_orphaned(elt); }