Skip to content

Commit

Permalink
lib: mempool-allocfree - make static analyzer happier with pool clearing
Browse files Browse the repository at this point in the history
It was thinking that already freed memory was being accessed.
  • Loading branch information
sirainen committed Dec 14, 2017
1 parent 11d4b18 commit 673ee24
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/mempool-allocfree.c
Expand Up @@ -225,9 +225,12 @@ static void pool_allocfree_clear(pool_t pool)
{
struct allocfree_pool *apool =
container_of(pool, struct allocfree_pool, pool);
struct pool_block *block, *next;

while(apool->blocks != NULL)
pool_allocfree_free(pool, apool->blocks->block);
for (block = apool->blocks; block != NULL; block = next) {
next = block->next;
pool_allocfree_free(pool, block->block);
}
i_assert(apool->total_alloc_used == 0 && apool->total_alloc_count == 0);
}

Expand Down

0 comments on commit 673ee24

Please sign in to comment.