From da52035a45d80485ca32a0b81651bba28cf00889 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 15 Nov 2019 06:59:54 +0100 Subject: [PATCH] MINOR: memory: also poison the area on freeing Doing so sometimes helps detect some UAF situations without the overhead associated to the DEBUG_UAF define. --- include/common/memory.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/common/memory.h b/include/common/memory.h index ae1ad22977..1aab6d460b 100644 --- a/include/common/memory.h +++ b/include/common/memory.h @@ -332,6 +332,8 @@ static inline void pool_free(struct pool_head *pool, void *ptr) if (*POOL_LINK(pool, ptr) != (void *)pool) *(volatile int *)0 = 0; #endif + if (mem_poison_byte >= 0) + memset(ptr, mem_poison_byte, pool->size); pool_put_to_cache(pool, ptr); } } -- 2.39.5