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.
(cherry picked from commit da52035a45d80485ca32a0b81651bba28cf00889)
[wt: will be helpful in bug reports]
Signed-off-by: Willy Tarreau <w@1wt.eu>
diff --git a/include/common/memory.h b/include/common/memory.h
index 8e61156..d21a176 100644
--- a/include/common/memory.h
+++ b/include/common/memory.h
@@ -332,6 +332,8 @@
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);
}
}