]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: proxy: free persist_rules
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 14 Jan 2026 10:19:13 +0000 (11:19 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 15 Jan 2026 08:08:18 +0000 (09:08 +0100)
force-persist proxy keyword is converted into a persist_rule, stored in
proxy persist_rules list member. Each new rule is dynamically allocated
during parsing.

This commit fixes the memory leak on deinit due to a missing free on
persist_rules list entries. This is done via deinit_proxy()
modification. Each rule in the list is freed, along with its associated
ACL condition type.

This can be backported to every stable version.

src/proxy.c

index f7c8a6c9e8db80bda746dfff79253258ea7b05de..bdfe0e76f5f02510d2f1c3b76f09d12eca41e938 100644 (file)
@@ -320,6 +320,12 @@ void deinit_proxy(struct proxy *p)
        EXTRA_COUNTERS_FREE(p->extra_counters_fe);
        EXTRA_COUNTERS_FREE(p->extra_counters_be);
 
+       list_for_each_entry_safe(rule, ruleb, &p->persist_rules, list) {
+               LIST_DELETE(&rule->list);
+               free_acl_cond(rule->cond);
+               free(rule);
+       }
+
        free_server_rules(&p->server_rules);
 
        list_for_each_entry_safe(rule, ruleb, &p->switching_rules, list) {