]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: server: fix dynamic server leak with check on failed init
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 22 Oct 2024 09:02:15 +0000 (11:02 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 24 Oct 2024 09:35:57 +0000 (11:35 +0200)
commit116178563c2fb57e28a76838cf85c4858b185b76
tree8fd2fca6c4d27f7d052b3113df4609b10aa59b1e
parentddb829bb51b5e53d7b9fe3439ac5c8d5163dde2e
BUG/MINOR: server: fix dynamic server leak with check on failed init

If a dynamic server is added with check or agent-check, its refcount is
incremented after server keyword parsing. However, if add server fails
at a later stage, refcount is only decremented once, which prevented the
server to be fully released.

This causes a leak with a server which is detached from most of the
lists but still exits in the system.

This bug is considered minor as only a few conditions may cause a
failure in add server after check/agent-check initialization. This is
the case if there is a naming collision or the dynamic ID cannot be
generated.

To fix this, simply decrement server refcount on add server error path
if either check and/or agent-check are flagged as activated.

This bug is related to github issue #2733. Thanks to Chris Staite who
first found the leak.

This must be backported up to 2.6.
src/server.c