mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
BUG/MINOR: backend: free allocated bind_addr if reuse conn
Fix a leak in connect_server which happens when a connection is reused and a bind_addr was allocated because transparent mode is active. The connection has already an allocated bind_addr so free the newly allocated one. No backport needed.
This commit is contained in:
parent
603657835f
commit
68967e595b
@ -1506,18 +1506,23 @@ skip_reuse:
|
|||||||
if (reuse_mode == PR_O_REUSE_NEVR)
|
if (reuse_mode == PR_O_REUSE_NEVR)
|
||||||
conn_set_private(srv_conn);
|
conn_set_private(srv_conn);
|
||||||
|
|
||||||
|
/* assign bind_addr to srv_conn */
|
||||||
srv_conn->src = bind_addr;
|
srv_conn->src = bind_addr;
|
||||||
|
bind_addr = NULL;
|
||||||
|
|
||||||
if (!sockaddr_alloc(&srv_conn->dst, 0, 0)) {
|
if (!sockaddr_alloc(&srv_conn->dst, 0, 0)) {
|
||||||
conn_free(srv_conn);
|
conn_free(srv_conn);
|
||||||
return SF_ERR_RESOURCE;
|
return SF_ERR_RESOURCE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
|
|
||||||
|
/* if bind_addr is non NULL free it */
|
||||||
sockaddr_free(&bind_addr);
|
sockaddr_free(&bind_addr);
|
||||||
|
|
||||||
|
/* srv_conn is still NULL only on allocation failure */
|
||||||
|
if (!srv_conn)
|
||||||
return SF_ERR_RESOURCE;
|
return SF_ERR_RESOURCE;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* copy the target address into the connection */
|
/* copy the target address into the connection */
|
||||||
*srv_conn->dst = *s->target_addr;
|
*srv_conn->dst = *s->target_addr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user