]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: proxy: fix default-server leak on post-parsing cleanup
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 17 Jul 2026 14:12:42 +0000 (16:12 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 3 Aug 2026 14:52:09 +0000 (16:52 +0200)
commitd705d3ba103d312d4b3e01f237ba3daa118f3c78
tree7b7645f8d52e8f5bb2be40c3ca86d6971123bc4a
parent7f099a65103a9c790c873085b1a5c80add8122e2
BUG/MINOR: proxy: fix default-server leak on post-parsing cleanup

A proxy with BE capabilities may define a default-server instance. This
instance is freed when config parser switch to another section. Beside
the server object, <conf.file> is also freed.

This causes a memleak if the default-server configuration is expanded
with keywords triggering dynamic allocations. For example, this is the
case if a cookie name is defined.

To fix this, use srv_free_params() on default-server deletion. This
function is designed to work both for server and default-server. It
ensures that every dynamic elements in it are freed. Only <id> member is
not freed by srv_free_params() : this is expected as it is a static
value for default-server instances.

Note that srv_free_params() is already used when default-server is freed
in deinit_proxy() since the following patch. However, post-parsing
cleanup has been added after it without reusing srv_free_params().

  899b547840c340cd129c3831d3858d8d2e5b452a
  BUG/MINOR: proxy/server: free default-server on deinit

This should be backported up to 2.8. Prior to it, srv_free_params() does
not exists, so it cannot be picked as is.
src/proxy.c