]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: call EXTRA_COUNTERS_FREE() before srv_free_params() in srv_drop()
authorWilly Tarreau <w@1wt.eu>
Thu, 26 Feb 2026 16:18:41 +0000 (17:18 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 26 Feb 2026 16:24:59 +0000 (17:24 +0100)
As seen with the last changes to counters allocation, the move of the
counters storage to the thread group as operated in commit 04a9f86a85
("MEDIUM: counters: add a dedicated storage for extra_counters in various
structs") causes some random errors when using ASAN, because the extra
counters are freed in srv_drop() after calling srv_free_params(), which
is responsible for freeing the per-thread group storage.

For the proxies however it's OK because free calls are made before the
call to deinit_proxy() which frees the per_tgrp area.

No backport is needed, this is purely 3.4-dev.

src/server.c

index 851e0e55e9c5df5128c557b65023dafccff416a6..4718257a12b38e96547b15cf157aec7957e78e83 100644 (file)
@@ -3253,6 +3253,8 @@ struct server *srv_drop(struct server *srv)
                        istfree(&srv->per_thr[i].quic_retry_token);
        }
 #endif
+       EXTRA_COUNTERS_FREE(srv->extra_counters);
+
        srv_free_params(srv);
 
        HA_SPIN_DESTROY(&srv->lock);
@@ -3260,8 +3262,6 @@ struct server *srv_drop(struct server *srv)
        MT_LIST_DELETE(&srv->global_list);
        event_hdl_sub_list_destroy(&srv->e_subs);
 
-       EXTRA_COUNTERS_FREE(srv->extra_counters);
-
        srv_free(&srv);
 
  end: