]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: backend: Fix a possible null pointer dereference
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 13 Sep 2019 08:01:36 +0000 (10:01 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 13 Sep 2019 08:08:44 +0000 (10:08 +0200)
In the function connect_server(), when we are not able to reuse a connection and
too many FDs are opened, the variable srv must be defined to kill an idle
connection.

This patch fixes the issue #257. It must be backported to 2.0

src/backend.c

index 1b01536c1de9323ce785a7a7aa4e1213e1e85cbd..f03b1ab65957bcf5c0588572c1365cf6ec499de8 100644 (file)
@@ -1268,7 +1268,7 @@ int connect_server(struct stream *s)
        }
 
        if (((!reuse || (srv_conn && !(srv_conn->flags & CO_FL_CONNECTED)))
-           && ha_used_fds > global.tune.pool_high_count) && srv->idle_orphan_conns) {
+           && ha_used_fds > global.tune.pool_high_count) && srv && srv->idle_orphan_conns) {
                struct connection *tokill_conn;
 
                /* We can't reuse a connection, and e have more FDs than deemd