util: slab_destroy_child should check whether it's been initialized
authorMarek Olšák <marek.olsak@amd.com>
Wed, 24 May 2017 16:16:41 +0000 (18:16 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Sun, 28 May 2017 23:52:16 +0000 (01:52 +0200)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/util/slab.c

index 4264814cabc926c623f47b5b1a9b70f5578f3664..4ce0e9a34852ca08d473c8585a322a71b93fdc5b 100644 (file)
@@ -140,6 +140,9 @@ void slab_create_child(struct slab_child_pool *pool,
  */
 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) {