From: Matt Caswell Date: Wed, 13 May 2020 13:45:36 +0000 (+0100) Subject: Fix error path in int create_ssl_ctx_pair() X-Git-Tag: openssl-3.0.0-alpha4~176 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0d52ede71685e4176999cc5e52000dcb540747fc;p=oweals%2Fopenssl.git Fix error path in int create_ssl_ctx_pair() If we hit the error path and create_ssl_ctx_pair has been passed a pre-created SSL_CTX then we could end up with a double free. Reviewed-by: Shane Lontis (Merged from https://github.com/openssl/openssl/pull/11834) --- diff --git a/test/ssltestlib.c b/test/ssltestlib.c index ce0e776110..96c1a7f2de 100644 --- a/test/ssltestlib.c +++ b/test/ssltestlib.c @@ -741,8 +741,10 @@ const SSL_METHOD *cm, return 1; err: - SSL_CTX_free(serverctx); - SSL_CTX_free(clientctx); + if (*sctx == NULL) + SSL_CTX_free(serverctx); + if (cctx != NULL && *cctx == NULL) + SSL_CTX_free(clientctx); return 0; }