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/checks.c b/src/checks.c
index c2fc87c..61acb17 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -1614,7 +1614,9 @@
 	/* Maybe there were an older connection we were waiting on */
 	check->wait_list.events = 0;
 
-	/* FIXME WTA: we'll have to dynamically allocate the dst address here */
+	if (!sockaddr_alloc(&conn->dst))
+		return SF_ERR_RESOURCE;
+
 	if (is_addr(&check->addr)) {
 		/* we'll connect to the check addr specified on the server */
 		*conn->dst = check->addr;
@@ -1643,10 +1645,6 @@
 	}
 
 	/* no client address */
-	/* FIXME WTA: we'll have to dynamically allocate the src address here
-	 * before clearing it, or better release it and make it null.
-	 */
-	clear_addr(conn->src);
 
 	conn_prepare(conn, proto, check->xprt);
 	if (conn_install_mux(conn, &mux_pt_ops, cs, s->proxy, NULL) < 0)
@@ -2862,12 +2860,12 @@
 			conn->target = s ? &s->obj_type : &proxy->obj_type;
 
 			/* no client address */
-			/* FIXME WTA: we'll have to dynamically allocate the src address here
-			 * before clearing it, or better release it and make it null.
-			 */
-			clear_addr(conn->src);
+
+			if (!sockaddr_alloc(&conn->dst)) {
+				ret = SF_ERR_RESOURCE;
+				goto fail_check;
+			}
 
-			/* FIXME WTA: we'll have to dynamically allocate the dst address here */
 			if (is_addr(&check->addr)) {
 				/* we'll connect to the check addr specified on the server */
 				*conn->dst = check->addr;