]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: server: fix memory leak on "default-server" parsing failures
authorFrederic Lecaille <flecaille@haproxy.com>
Wed, 12 Aug 2026 13:04:58 +0000 (15:04 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Wed, 12 Aug 2026 13:51:40 +0000 (15:51 +0200)
commit93599eca13e8f66041af06b64f6443d3be3e9ac4
tree535c5c15190e4fa63417639a44f7337d50246f20
parentb644541e0f3b7e4bb9b41c0b7c0c24f62f6c61fd
BUG/MINOR: server: fix memory leak on "default-server" parsing failures

This is a fix for very minor bug which may be triggerd only at parsing time
upon parsing failures (allocation failure, or default server name mismatch).

When parsing a named "default-server" instance in _srv_parse_init(), <name> is
allocated via strdup(). If a name mismatch occurs or if srv_alloc() fails,
the function jumps to the <out> label without freeing this string.

Fix this by initializing <name> to NULL at the function start and calling
free(name) in the <out> cleanup block.

This issue was reported by GH #3462.

No need to backport.
src/server.c