mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
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]
This commit is contained in:
parent
ad54273cf9
commit
64b5ab87ef
@ -263,6 +263,8 @@ void free_proxy(struct proxy *p)
|
||||
list_for_each_entry_safe(rule, ruleb, &p->switching_rules, list) {
|
||||
LIST_DELETE(&rule->list);
|
||||
free_acl_cond(rule->cond);
|
||||
if (rule->dynamic)
|
||||
free_logformat_list(&rule->be.expr);
|
||||
free(rule->file);
|
||||
free(rule);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user