From f623a68efad0b00c698b3e10963f51971f55ffba Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Mon, 27 Sep 2021 14:22:40 +0200 Subject: Fix ssl_free() and thus BIO_free() to respect BIO_NOCLOSE Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/17135) --- ssl/bio_ssl.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'ssl') diff --git a/ssl/bio_ssl.c b/ssl/bio_ssl.c index c4239345b6..67097d5cca 100644 --- a/ssl/bio_ssl.c +++ b/ssl/bio_ssl.c @@ -76,13 +76,12 @@ static int ssl_free(BIO *a) if (a == NULL) return 0; bs = BIO_get_data(a); - if (bs->ssl != NULL) - SSL_shutdown(bs->ssl); if (BIO_get_shutdown(a)) { + if (bs->ssl != NULL) + SSL_shutdown(bs->ssl); if (BIO_get_init(a)) SSL_free(bs->ssl); - /* Clear all flags */ - BIO_clear_flags(a, ~0); + BIO_clear_flags(a, ~0); /* Clear all flags */ BIO_set_init(a, 0); } OPENSSL_free(bs); -- cgit v1.2.3