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.
This commit is contained in:
Willy Tarreau 2026-02-26 17:18:41 +01:00
parent b604064980
commit 9db62d408a

View 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: