mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-05 14:47:07 +02:00
BUG/MINOR: server: free PROXY v2 TLVs on srv drop
Dynamically allocated servers PROXY TLVs were not freed on server release. This patch fixes this leak by extending srv_free_params(). Every server line with set-proxy-v2-tlv-fmt keyword is impacted. For static servers, issue is minimal as it will only cause leak on deinit(). However, this could be aggravated when performing multiple removal of dynamic servers. This should be backported up to 2.9.
This commit is contained in:
parent
8b72270e95
commit
3efd9f3925
10
src/server.c
10
src/server.c
@ -2898,6 +2898,8 @@ void srv_take(struct server *srv)
|
||||
/* deallocate common server parameters (may be used by default-servers) */
|
||||
void srv_free_params(struct server *srv)
|
||||
{
|
||||
struct srv_pp_tlv_list *srv_tlv = NULL;
|
||||
|
||||
free(srv->cookie);
|
||||
free(srv->rdr_pfx);
|
||||
free(srv->hostname);
|
||||
@ -2916,6 +2918,14 @@ void srv_free_params(struct server *srv)
|
||||
|
||||
if (xprt_get(XPRT_SSL) && xprt_get(XPRT_SSL)->destroy_srv)
|
||||
xprt_get(XPRT_SSL)->destroy_srv(srv);
|
||||
|
||||
while (!LIST_ISEMPTY(&srv->pp_tlvs)) {
|
||||
srv_tlv = LIST_ELEM(srv->pp_tlvs.n, struct srv_pp_tlv_list *, list);
|
||||
LIST_DEL_INIT(&srv_tlv->list);
|
||||
lf_expr_deinit(&srv_tlv->fmt);
|
||||
ha_free(&srv_tlv->fmt_string);
|
||||
ha_free(&srv_tlv);
|
||||
}
|
||||
}
|
||||
|
||||
/* Deallocate a server <srv> and its member. <srv> must be allocated. For
|
||||
|
Loading…
Reference in New Issue
Block a user