]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: deinit: release uri_auth admin rules
authorAurelien DARRAGON <adarragon@haproxy.com>
Wed, 13 Nov 2024 17:26:34 +0000 (18:26 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Thu, 14 Nov 2024 14:03:27 +0000 (15:03 +0100)
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.

src/haproxy.c

index 83cbffcb5412363fbc9186615bee5d7e221cee54..3496ba8151748682a58f5059988c2b4e1aa2a59a 100644 (file)
@@ -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) {