mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-15 16:04:37 +00:00
BUG/MINOR: mailers: Fix a memory leak when email alerts are released
An email alert contains a list of tcpcheck_rule. Each one is dynamically allocated, just like its internal members. So, when an email alerts is freed, we must be sure to properly free each tcpcheck_rule too. This patch must be backported in 1.7 and 1.6.
This commit is contained in:
parent
67957bd59e
commit
de1a75b869
@ -3038,8 +3038,14 @@ void email_alert_free(struct email_alert *alert)
|
||||
if (!alert)
|
||||
return;
|
||||
|
||||
list_for_each_entry_safe(rule, back, &alert->tcpcheck_rules, list)
|
||||
list_for_each_entry_safe(rule, back, &alert->tcpcheck_rules, list) {
|
||||
LIST_DEL(&rule->list);
|
||||
free(rule->comment);
|
||||
free(rule->string);
|
||||
if (rule->expect_regex)
|
||||
regex_free(rule->expect_regex);
|
||||
free(rule);
|
||||
}
|
||||
free(alert);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user