From 9db62d408a2011253ecd5ba748039fb30265b773 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 26 Feb 2026 17:18:41 +0100 Subject: [PATCH] BUG/MINOR: call EXTRA_COUNTERS_FREE() before srv_free_params() in srv_drop() 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server.c b/src/server.c index 851e0e55e..4718257a1 100644 --- a/src/server.c +++ b/src/server.c @@ -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: