From 2538f4a15bcf71bb4da19247aa3c3f854be670da Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 3 Mar 2022 18:31:54 +0100 Subject: [PATCH] BUG/MEDIUM: pools: fix ha_free() on area in the process of being freed Commit e81248c0c ("BUG/MINOR: pool: always align pool_heads to 64 bytes") added a free of the allocated pool in pool_destroy() using ha_free(), but it added a subtle bug by which once the pool is released, setting its address to NULL inside the structure itself cannot work because the area has just been freed. This will need to be backported wherever the patch above is backported. (cherry picked from commit f9eba78fb82a9ccca2503e318a79be4d7db8d94d) Signed-off-by: Willy Tarreau --- src/pool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pool.c b/src/pool.c index 6756421..ba1d235 100644 --- a/src/pool.c +++ b/src/pool.c @@ -523,7 +523,7 @@ void *pool_destroy(struct pool_head *pool) if (!pool->users) { LIST_DELETE(&pool->list); /* note that if used == 0, the cache is empty */ - ha_free(&pool->base_addr); + free(pool->base_addr); } } return NULL; -- 1.7.10.4