MEDIUM: connection: make sure all address producers allocate their address
This commit places calls to sockaddr_alloc() at the places where an address
is needed, and makes sure that the allocation is properly tested. This does
not add too many error paths since connection allocations are already in the
vicinity and share the same error paths. For the two cases where a
clear_addr() was called, instead the address was not allocated.
diff --git a/src/backend.c b/src/backend.c
index 18d2498..dcf3642 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -826,7 +826,8 @@
DPRINTF(stderr,"assign_server_address : s=%p\n",s);
- /* FIXME WTA: an address allocation will soon be needed here */
+ if (!sockaddr_alloc(&srv_conn->dst))
+ return SRV_STATUS_INTERNAL;
if ((s->flags & SF_DIRECT) || (s->be->lbprm.algo & BE_LB_KIND)) {
/* A server is necessarily known for this stream */
@@ -1039,7 +1040,8 @@
else
return;
- /* FIXME WTA: an address allocation will soon be needed here for src */
+ if (!sockaddr_alloc(&srv_conn->src))
+ return;
switch (src->opts & CO_SRC_TPROXY_MASK) {
case CO_SRC_TPROXY_ADDR: