From f10533f0b8557613e95e10020178c610b427c3ce Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Wed, 8 Jan 2025 15:55:35 +0100 Subject: [PATCH] mem_pool_alloc: fix mutex alloc order --- src/mem/mem_pool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mem/mem_pool.c b/src/mem/mem_pool.c index 3c721debf..404ff6d34 100644 --- a/src/mem/mem_pool.c +++ b/src/mem/mem_pool.c @@ -81,12 +81,12 @@ int mem_pool_alloc(struct mem_pool **poolp, size_t nmemb, size_t membsize, goto error; } + mem_destructor(p, mem_pool_destroy); + err = mutex_alloc(&p->lock); if (err) goto error; - mem_destructor(p, mem_pool_destroy); - for (size_t i = 0; i < nmemb; i++) { p->objs[i].member = mem_zalloc(membsize, dh); if (!p->objs[i].member) {