Skip to content

Commit

Permalink
mem_pool: fix locking on flush
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Jan 8, 2025
1 parent 72054c3 commit dce2dda
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mem/mem_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ void *mem_pool_release(struct mem_pool *pool, struct mem_pool_entry *e)
*/
void mem_pool_flush(struct mem_pool *pool)
{
mtx_lock(pool->lock);
list_clear(&pool->freel);
for (size_t i = 0; i < pool->nmemb; i++) {
struct mem_pool_entry *e = &pool->objs[i];
Expand All @@ -236,6 +237,7 @@ void mem_pool_flush(struct mem_pool *pool)
memset(e->member, 0, pool->membsize);
list_append(&pool->freel, &e->le, e);
}
mtx_unlock(pool->lock);
}


Expand Down

0 comments on commit dce2dda

Please sign in to comment.