]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: tools: fix memory leak in env_expand() error path
authorWilly Tarreau <w@1wt.eu>
Mon, 11 May 2026 13:04:19 +0000 (15:04 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 11 May 2026 14:04:19 +0000 (16:04 +0200)
commit0995c914bd6406264e24b44278bbc806c43ba67c
treee88e9f942c6114cff5444f7ccc8d8a5e6528ee5f
parentcbdbc96e363977ff5b8afc7b25307421ee9446ff
BUG/MINOR: tools: fix memory leak in env_expand() error path

When my_realloc2() fails in env_expand(), the code jumps to 'leave:' and
returns NULL, but the original input 'in' is never freed (it's only freed
at line 4919 in the success case). Given that callers typically pass it
the direct return of strdup(), it looks like it is expected to always be
freed. This can be backported everywhere.
src/tools.c