MINOR: ssl: Make sure the underlying xprt's init method doesn't fail.

In ssl_sock_init(), when initting the underlying xprt, check the return value,
and give up if it fails.
This commit is contained in:
Olivier Houchard 2019-05-23 18:24:07 +02:00 committed by Olivier Houchard
parent 11c90fbd92
commit 19afb274ad

View File

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