]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG: tcp: close socket fd upon connect error
authorWilly Tarreau <w@1wt.eu>
Thu, 6 Sep 2012 12:04:41 +0000 (14:04 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 6 Sep 2012 12:04:41 +0000 (14:04 +0200)
When the data layer fails to initialize (eg: out of memory for SSL), we
must close the socket fd we just allocated.

src/proto_tcp.c

index b43731cb91369fe2b2bdd902a4a459f6edcb0639..f819147820e637fdd770f3c4a4acbd967b3ac46e 100644 (file)
@@ -459,8 +459,10 @@ int tcp_connect_server(struct connection *conn, int data)
        fd_insert(fd);
        conn_sock_want_send(conn);  /* for connect status */
 
-       if (conn_data_init(conn) < 0)
+       if (conn_data_init(conn) < 0) {
+               fd_delete(fd);
                return SN_ERR_RESOURCE;
+       }
 
        if (data)
                conn_data_want_send(conn);  /* prepare to send data if any */