mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-15 21:59:41 -04:00
[MINOR] Free tcp 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
a31c7f716b
commit
ac8214260e
1 changed files with 28 additions and 0 deletions
|
|
@ -66,6 +66,8 @@
|
|||
|
||||
#include <types/capture.h>
|
||||
#include <types/global.h>
|
||||
#include <types/proto_tcp.h>
|
||||
#include <types/acl.h>
|
||||
|
||||
#include <proto/auth.h>
|
||||
#include <proto/acl.h>
|
||||
|
|
@ -672,6 +674,29 @@ void init(int argc, char **argv)
|
|||
|
||||
}
|
||||
|
||||
static void deinit_tcp_rules(struct list *rules)
|
||||
{
|
||||
struct tcp_rule *trule, *truleb;
|
||||
struct acl_term_suite *suite, *suiteb;
|
||||
struct acl_term *term, *termb;
|
||||
|
||||
list_for_each_entry_safe(trule, truleb, rules, list) {
|
||||
if (trule->cond) {
|
||||
list_for_each_entry_safe(suite, suiteb, &trule->cond->suites, list) {
|
||||
list_for_each_entry_safe(term, termb, &suite->terms, list) {
|
||||
LIST_DEL(&term->list);
|
||||
free(term);
|
||||
}
|
||||
LIST_DEL(&suite->list);
|
||||
free(suite);
|
||||
}
|
||||
}
|
||||
LIST_DEL(&trule->list);
|
||||
free(trule->cond);
|
||||
free(trule);
|
||||
}
|
||||
}
|
||||
|
||||
void deinit(void)
|
||||
{
|
||||
struct proxy *p = proxy, *p0;
|
||||
|
|
@ -791,6 +816,9 @@ void deinit(void)
|
|||
free(rdr);
|
||||
}
|
||||
|
||||
deinit_tcp_rules(&p->tcp_req.inspect_rules);
|
||||
deinit_tcp_rules(&p->tcp_req.l4_rules);
|
||||
|
||||
free(p->appsession_name);
|
||||
|
||||
h = p->req_cap;
|
||||
|
|
|
|||
Loading…
Reference in a new issue