BUG/MINOR: proxy: fix logformat expression leak in use_backend rules

When support for dynamic names was added for use_backend rules in
702d44f2f ("MEDIUM: proxy: support use_backend with dynamic names"), the
sample expression resulting from parse_logformat_string() was only freed
for non dynamic rules (when the expression resolved to a simple string
node). But for complex expressions (ie: multiple nodes), rule->dynamic
was set but the expression was never released, resulting in a small
memory leak when freeing the parent proxy.

To fix the issue, in free_proxy(), we free the switching rule expression
if the switching rule is dynamic.

This should be backported to every stable versions.
[ada: prior to 2.9, free_logformat_list() helper did not exist: we may
 use the same manual sample expr freeing logic as in server_rules pruning
 right above it]

(cherry picked from commit 64b5ab87ef32e282fc27fdf53380494512cc3562)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 4d95b87c38389f17deba6201e3fe50e95104915d)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 6965667fbaff5a6780f8b843ea2309aca0afd1ea)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 57b9ceb882cbf9e4c75762c49391d8e9e81612ff)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit ed76c3332b07d23fd271061e942baec9a1e3aa99)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed