From 6db9a97f6101fd6bd2e9dd35976550ce4f83b725 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 15 Oct 2021 14:33:34 +0200 Subject: [PATCH] BUG/MINOR: proxy: Release ACLs and TCP/HTTP rules of default proxies It is now possible to have TCP/HTTP rules and ACLs defined in defaults sections. So we must try to release corresponding lists when a default proxy is destroyed. No backport needed. --- src/proxy.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/proxy.c b/src/proxy.c index 27a917dfde..ff5e35e2cc 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -1417,6 +1417,8 @@ void proxy_preset_defaults(struct proxy *defproxy) */ void proxy_free_defaults(struct proxy *defproxy) { + struct acl *acl, *aclb; + ha_free(&defproxy->id); ha_free(&defproxy->conf.file); ha_free(&defproxy->check_command); @@ -1435,6 +1437,20 @@ void proxy_free_defaults(struct proxy *defproxy) ha_free(&defproxy->orgto_hdr_name); defproxy->orgto_hdr_len = 0; ha_free(&defproxy->server_id_hdr_name); defproxy->server_id_hdr_len = 0; + list_for_each_entry_safe(acl, aclb, &defproxy->acl, list) { + LIST_DELETE(&acl->list); + prune_acl(acl); + free(acl); + } + + free_act_rules(&defproxy->tcp_req.inspect_rules); + free_act_rules(&defproxy->tcp_rep.inspect_rules); + free_act_rules(&defproxy->tcp_req.l4_rules); + free_act_rules(&defproxy->tcp_req.l5_rules); + free_act_rules(&defproxy->http_req_rules); + free_act_rules(&defproxy->http_res_rules); + free_act_rules(&defproxy->http_after_res_rules); + if (defproxy->conf.logformat_string != default_http_log_format && defproxy->conf.logformat_string != default_tcp_log_format && defproxy->conf.logformat_string != clf_http_log_format &&