From: Willy Tarreau Date: Sun, 28 Oct 2018 19:36:00 +0000 (+0100) Subject: BUG/MINOR: backend: assign the wait list after the error check X-Git-Tag: v1.9-dev5~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cde1bc64cbdb76a04ecea8e2da74437498301275;p=thirdparty%2Fhaproxy.git BUG/MINOR: backend: assign the wait list after the error check Commit 85b73e9 ("BUG/MEDIUM: stream: Make sure polling is right on retry.") introduced a possible null dereference on the error path detected by gcc-7. Let's simply assign srv_conn after checking the error and not before. No backport is needed. --- diff --git a/src/backend.c b/src/backend.c index 834caec1f5..4d75df6fea 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1167,12 +1167,13 @@ int connect_server(struct stream *s) LIST_DEL(&srv_conn->list); LIST_INIT(&srv_conn->list); } - srv_conn->send_wait = send_wait; - srv_conn->recv_wait = recv_wait; if (!srv_cs) return SF_ERR_RESOURCE; + srv_conn->send_wait = send_wait; + srv_conn->recv_wait = recv_wait; + if (!(s->flags & SF_ADDR_SET)) { err = assign_server_address(s); if (err != SRV_STATUS_OK)