]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: backend: assign the wait list after the error check
authorWilly Tarreau <w@1wt.eu>
Sun, 28 Oct 2018 19:36:00 +0000 (20:36 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 28 Oct 2018 19:36:00 +0000 (20:36 +0100)
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.

src/backend.c

index 834caec1f5f55973aae3d90a7f764b24975d73ec..4d75df6fea2a745514da35467df16a64df522c84 100644 (file)
@@ -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)