From 57b83edc46926662491d63666231ba7ddc954a38 Mon Sep 17 00:00:00 2001 From: erbsland-dev Date: Sat, 22 Jun 2024 09:14:25 +0200 Subject: [PATCH] bio_ssl.c: Do not call SSL_shutdown if not inited Fixes #4545 If free is called for an SSL BIO that is in initialization phase, the `SSL_shutdown` call is omitted. Reviewed-by: Neil Horman Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/24705) --- ssl/bio_ssl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssl/bio_ssl.c b/ssl/bio_ssl.c index aabd047fe580a..ac65a3988bd10 100644 --- a/ssl/bio_ssl.c +++ b/ssl/bio_ssl.c @@ -79,7 +79,7 @@ static int ssl_free(BIO *a) return 0; bs = BIO_get_data(a); if (BIO_get_shutdown(a)) { - if (bs->ssl != NULL) + if (bs->ssl != NULL && !SSL_in_init(bs->ssl)) SSL_shutdown(bs->ssl); if (BIO_get_init(a)) SSL_free(bs->ssl);