]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: haproxy: Free per_thread_*_list in deinit()
authorTim Duesterhus <tim@bastelstu.be>
Thu, 10 Sep 2020 17:46:41 +0000 (19:46 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 11 Sep 2020 05:54:39 +0000 (07:54 +0200)
This allocation is technically always reachable and cannot leak, but so are
a few others that *are* freed.

src/haproxy.c

index b01707096a1e891f9e5683d786306931334acbe1..0dc81c78c6c9b9b76fe2129990d4b6596acc17bc 100644 (file)
@@ -2402,6 +2402,10 @@ void deinit(void)
        struct post_deinit_fct *pdf, *pdfb;
        struct proxy_deinit_fct *pxdf, *pxdfb;
        struct server_deinit_fct *srvdf, *srvdfb;
+       struct per_thread_init_fct *tif, *tifb;
+       struct per_thread_deinit_fct *tdf, *tdfb;
+       struct per_thread_alloc_fct *taf, *tafb;
+       struct per_thread_free_fct *tff, *tffb;
        struct post_server_check_fct *pscf, *pscfb;
        struct post_proxy_check_fct *ppcf, *ppcfb;
 
@@ -2728,6 +2732,26 @@ void deinit(void)
                free(ppcf);
        }
 
+       list_for_each_entry_safe(tif, tifb, &per_thread_init_list, list) {
+               LIST_DEL(&tif->list);
+               free(tif);
+       }
+
+       list_for_each_entry_safe(tdf, tdfb, &per_thread_deinit_list, list) {
+               LIST_DEL(&tdf->list);
+               free(tdf);
+       }
+
+       list_for_each_entry_safe(taf, tafb, &per_thread_alloc_list, list) {
+               LIST_DEL(&taf->list);
+               free(taf);
+       }
+
+       list_for_each_entry_safe(tff, tffb, &per_thread_free_list, list) {
+               LIST_DEL(&tff->list);
+               free(tff);
+       }
+
        vars_prune(&global.vars, NULL, NULL);
        pool_destroy_all();
        deinit_pollers();