Skip to content

Commit

Permalink
mem_pool_alloc: fix mutex alloc order
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Jan 8, 2025
1 parent dce2dda commit f10533f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mem/mem_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f10533f

Please sign in to comment.