From 18759079b6039ef748e3fdaea91f3a12f97f782a Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 22 Mar 2021 22:05:05 +0100 Subject: [PATCH] MINOR: pools: add pool_zalloc() to return a zeroed area It's like pool_alloc() but the output is zeroed before being returned and is never poisonned. --- include/haproxy/pool.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/haproxy/pool.h b/include/haproxy/pool.h index b37fb9d3e..ce1371037 100644 --- a/include/haproxy/pool.h +++ b/include/haproxy/pool.h @@ -325,6 +325,15 @@ static inline void *pool_alloc(struct pool_head *pool) return __pool_alloc(pool, 0); } +/* + * Returns a pointer to type taken from the pool or + * dynamically allocated. The area is zeroed. + */ +static inline void *pool_zalloc(struct pool_head *pool) +{ + return __pool_alloc(pool, POOL_F_MUST_ZERO); +} + /* * Puts a memory area back to the corresponding pool. * Items are chained directly through a pointer that