diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 5ca59eb47..99133f0f9 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -5937,6 +5937,8 @@ static int ssl_sock_init(struct connection *conn, void **xprt_ctx) } ctx->bio = BIO_new(ha_meth); if (!ctx->bio) { + SSL_free(ctx->ssl); + ctx->ssl = NULL; if (may_retry--) { pool_gc(NULL); goto retry_connect; @@ -5999,6 +6001,8 @@ static int ssl_sock_init(struct connection *conn, void **xprt_ctx) } ctx->bio = BIO_new(ha_meth); if (!ctx->bio) { + SSL_free(ctx->ssl); + ctx->ssl = NULL; if (may_retry--) { pool_gc(NULL); goto retry_accept;