mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 23:56:57 +02:00
[MINOR] Free stick rules on denint()
The motivation for this is that when soft-restart is merged it will be come more important to free all relevant memory in deinit() Discovered using valgrind.
This commit is contained in:
parent
b08584ac71
commit
6fb8259014
@ -674,29 +674,67 @@ void init(int argc, char **argv)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deinit_tcp_rules(struct list *rules)
|
static void deinit_acl_cond(struct acl_cond *cond)
|
||||||
{
|
{
|
||||||
struct tcp_rule *trule, *truleb;
|
|
||||||
struct acl_term_suite *suite, *suiteb;
|
struct acl_term_suite *suite, *suiteb;
|
||||||
struct acl_term *term, *termb;
|
struct acl_term *term, *termb;
|
||||||
|
|
||||||
list_for_each_entry_safe(trule, truleb, rules, list) {
|
if (!cond)
|
||||||
if (trule->cond) {
|
return;
|
||||||
list_for_each_entry_safe(suite, suiteb, &trule->cond->suites, list) {
|
|
||||||
list_for_each_entry_safe(term, termb, &suite->terms, list) {
|
list_for_each_entry_safe(suite, suiteb, &cond->suites, list) {
|
||||||
LIST_DEL(&term->list);
|
list_for_each_entry_safe(term, termb, &suite->terms, list) {
|
||||||
free(term);
|
LIST_DEL(&term->list);
|
||||||
}
|
free(term);
|
||||||
LIST_DEL(&suite->list);
|
|
||||||
free(suite);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
LIST_DEL(&suite->list);
|
||||||
|
free(suite);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(cond);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void deinit_tcp_rules(struct list *rules)
|
||||||
|
{
|
||||||
|
struct tcp_rule *trule, *truleb;
|
||||||
|
|
||||||
|
list_for_each_entry_safe(trule, truleb, rules, list) {
|
||||||
LIST_DEL(&trule->list);
|
LIST_DEL(&trule->list);
|
||||||
free(trule->cond);
|
deinit_acl_cond(trule->cond);
|
||||||
free(trule);
|
free(trule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void deinit_pattern_arg(struct pattern_arg *p, int i)
|
||||||
|
{
|
||||||
|
if (!p)
|
||||||
|
return;
|
||||||
|
|
||||||
|
while (i--)
|
||||||
|
if (p[i].type == PATTERN_ARG_TYPE_STRING)
|
||||||
|
free(p[i].data.str.str);
|
||||||
|
|
||||||
|
free(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void deinit_stick_rules(struct list *rules)
|
||||||
|
{
|
||||||
|
struct sticking_rule *rule, *ruleb;
|
||||||
|
|
||||||
|
list_for_each_entry_safe(rule, ruleb, rules, list) {
|
||||||
|
LIST_DEL(&rule->list);
|
||||||
|
deinit_acl_cond(rule->cond);
|
||||||
|
if (rule->expr) {
|
||||||
|
struct pattern_conv_expr *conv_expr, *conv_exprb;
|
||||||
|
list_for_each_entry_safe(conv_expr, conv_exprb, &rule->expr->conv_exprs, list)
|
||||||
|
deinit_pattern_arg(conv_expr->arg_p, conv_expr->arg_i);
|
||||||
|
deinit_pattern_arg(rule->expr->arg_p, rule->expr->arg_i);
|
||||||
|
free(rule->expr);
|
||||||
|
}
|
||||||
|
free(rule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void deinit(void)
|
void deinit(void)
|
||||||
{
|
{
|
||||||
struct proxy *p = proxy, *p0;
|
struct proxy *p = proxy, *p0;
|
||||||
@ -819,6 +857,9 @@ void deinit(void)
|
|||||||
deinit_tcp_rules(&p->tcp_req.inspect_rules);
|
deinit_tcp_rules(&p->tcp_req.inspect_rules);
|
||||||
deinit_tcp_rules(&p->tcp_req.l4_rules);
|
deinit_tcp_rules(&p->tcp_req.l4_rules);
|
||||||
|
|
||||||
|
deinit_stick_rules(&p->storersp_rules);
|
||||||
|
deinit_stick_rules(&p->sticking_rules);
|
||||||
|
|
||||||
free(p->appsession_name);
|
free(p->appsession_name);
|
||||||
|
|
||||||
h = p->req_cap;
|
h = p->req_cap;
|
||||||
|
Loading…
Reference in New Issue
Block a user