BUG/MINOR: check: fix leak on add dynamic server with agent-check error
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 10 Aug 2021 14:22:51 +0000 (16:22 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 11 Aug 2021 12:37:42 +0000 (14:37 +0200)
commit6d7fc446b47f1c51819ac519a1a1e52fdde6842b
tree44782b52122eb735a9ff51ed294e5b18fedf14d6
parent25fe1033cba2916f21d5ea3b4ccd6c74b56350e9
BUG/MINOR: check: fix leak on add dynamic server with agent-check error

If an error occured during a dynamic server creation, free_check is used
to liberate a possible agent-check. However, this does not free
associated vars and rules associated as this is done on another function
named deinit_srv_agent_check.

To simplify the check free and avoid a leak, move free vars/rules in
free_check. This is valid because deinit_srv_agent_check also uses
free_check.

This operation is done only for an agent-check because for a health
check, the proxy instance is the owner of check vars/rules.

This should not be backported, unless dynamic server checks are
backported.
src/check.c