From: Willy Tarreau Date: Fri, 15 Nov 2019 05:59:54 +0000 (+0100) Subject: MINOR: memory: also poison the area on freeing X-Git-Tag: v2.1-dev5~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da52035a45;p=thirdparty%2Fhaproxy.git 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. --- 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); } }