diff options
author | Matt Caswell <matt@openssl.org> | 2020-05-13 14:45:36 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2020-06-05 10:31:58 +0100 |
commit | 0d52ede71685e4176999cc5e52000dcb540747fc (patch) | |
tree | 0f476822894cf2f26b7bc02fdc40b521aff46009 | |
parent | b38425393c76ff31560d6b0bdb0b097e7d93ffc4 (diff) | |
download | openssl-0d52ede71685e4176999cc5e52000dcb540747fc.tar.gz |
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 <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11834)
-rw-r--r-- | test/ssltestlib.c | 6 |
1 files changed, 4 insertions, 2 deletions
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; } |