]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: sink: free forward_px on deinit()
authorAurelien DARRAGON <adarragon@haproxy.com>
Thu, 9 Mar 2023 11:07:09 +0000 (12:07 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Apr 2023 06:58:16 +0000 (08:58 +0200)
When a ring section is configured, a new sink is created and forward_px
proxy may be allocated and assigned to the sink.
Such sink-related proxies are added to the sink_proxies_list and thus
don't belong to the main proxy list which is cleaned up in
haproxy deinit() function.

We don't have to manually clean up sink_proxies_list in the main deinit()
func:
sink API already provides the sink_deinit() function so we just add the
missing free_proxy(sink->forward_px) there.

This could be backported up to 2.4.
[in 2.4, commit b0281a49 ("MINOR: proxy: check if p is NULL in free_proxy()")
must be backported first]

src/haproxy.c
src/sink.c

index 852e514025f9f9b6643d40f262e89f49292cbb98..3195be69de9c4769ffac545fc5b22657350cbcd6 100644 (file)
@@ -2780,6 +2780,10 @@ void deinit(void)
                free_proxy(p0);
        }/* end while(p) */
 
+       /* we don't need to free sink_proxies_list proxies since it is
+        * already handled in sink_deinit()
+        */
+
        /* destroy all referenced defaults proxies  */
        proxy_destroy_all_unref_defaults();
 
index 67bdcaa39ffef1e1d59ffeaa310c31fe7fd2fd93..55b6ad1ece870258c2f5c461b025a0bdb5f6924d 100644 (file)
@@ -1368,6 +1368,7 @@ static void sink_deinit()
                }
                LIST_DELETE(&sink->sink_list);
                task_destroy(sink->forward_task);
+               free_proxy(sink->forward_px);
                free(sink->name);
                free(sink->desc);
                free(sink);