mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-17 17:04:35 +00: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,19 +1506,24 @@ skip_reuse:
|
||||
if (reuse_mode == PR_O_REUSE_NEVR)
|
||||
conn_set_private(srv_conn);
|
||||
|
||||
/* assign bind_addr to srv_conn */
|
||||
srv_conn->src = bind_addr;
|
||||
bind_addr = NULL;
|
||||
|
||||
if (!sockaddr_alloc(&srv_conn->dst, 0, 0)) {
|
||||
conn_free(srv_conn);
|
||||
return SF_ERR_RESOURCE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
sockaddr_free(&bind_addr);
|
||||
return SF_ERR_RESOURCE;
|
||||
}
|
||||
}
|
||||
|
||||
/* if bind_addr is non NULL free it */
|
||||
sockaddr_free(&bind_addr);
|
||||
|
||||
/* srv_conn is still NULL only on allocation failure */
|
||||
if (!srv_conn)
|
||||
return SF_ERR_RESOURCE;
|
||||
|
||||
/* copy the target address into the connection */
|
||||
*srv_conn->dst = *s->target_addr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user