]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: proxy: fix logformat expression leak in use_backend rules
authorAurelien DARRAGON <adarragon@haproxy.com>
Wed, 13 Mar 2024 15:29:38 +0000 (16:29 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Thu, 4 Apr 2024 17:10:01 +0000 (19:10 +0200)
commit64b5ab87ef32e282fc27fdf53380494512cc3562
tree6246ab02ddd5c945f3da04a97481503b018d9083
parentad54273cf93e9a9e957f40cebeecd53c06040bd9
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]
src/proxy.c