]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: ssl: Make sure the underlying xprt's init method doesn't fail.
authorOlivier Houchard <ohouchard@haproxy.com>
Thu, 23 May 2019 16:24:07 +0000 (18:24 +0200)
committerOlivier Houchard <cognet@ci0.org>
Tue, 28 May 2019 08:08:28 +0000 (10:08 +0200)
In ssl_sock_init(), when initting the underlying xprt, check the return value,
and give up if it fails.

src/ssl_sock.c

index 6f62375ac4e25fce8453a67cf3c0577769492667..5393756c2b3ad1635fc8e886fda7942427cb20b5 100644 (file)
@@ -5118,8 +5118,12 @@ static int ssl_sock_init(struct connection *conn, void **xprt_ctx)
         * add QUIC support.
         */
        ctx->xprt = xprt_get(XPRT_RAW);
-       if (ctx->xprt->init)
-               ctx->xprt->init(conn, &ctx->xprt_ctx);
+       if (ctx->xprt->init) {
+               if (ctx->xprt->init(conn, &ctx->xprt_ctx) != 0) {
+                       pool_free(ssl_sock_ctx_pool, ctx);
+                       return -1;
+               }
+       }
 
        if (global.maxsslconn && sslconns >= global.maxsslconn) {
                conn->err_code = CO_ER_SSL_TOO_MANY;