From: Aurelien DARRAGON Date: Wed, 13 Nov 2024 17:26:34 +0000 (+0100) Subject: BUG/MINOR: deinit: release uri_auth admin rules X-Git-Tag: v3.1-dev13~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=350a3ab052e94d8b1ce1f526705a352cfd7d451c;p=thirdparty%2Fhaproxy.git BUG/MINOR: deinit: release uri_auth admin rules When uri_auth admin rules were implemented in 474be415 ("[MEDIUM] stats: add an admin level") no attempt was made to free the list of allocated rules, which makes valgrind unhappy upon deinit when "stats admin" is used in the config. To fix the issue, let's cleanup the admin rules list upon deinit where uri_auth freeing is already handled. While this could be backported to every stable versions, given how minor this is and has no impact on the dying process, it is probably not worth the effort. --- diff --git a/src/haproxy.c b/src/haproxy.c index 83cbffcb54..3496ba8151 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -3284,6 +3284,7 @@ void deinit(void) while (ua) { struct stat_scope *scope, *scopep; + struct stats_admin_rule *rule, *ruleb; uap = ua; ua = ua->next; @@ -3295,6 +3296,11 @@ void deinit(void) userlist_free(uap->userlist); free_act_rules(&uap->http_req_rules); + list_for_each_entry_safe(rule, ruleb, &uap->admin_rules, list) { + LIST_DELETE(&rule->list); + free_acl_cond(rule->cond); + free(rule); + } scope = uap->scope; while (scope) {