From: Dr. David von Oheimb Date: Mon, 27 Sep 2021 12:22:40 +0000 (+0200) Subject: Fix ssl_free() and thus BIO_free() to respect BIO_NOCLOSE X-Git-Tag: openssl-3.2.0-alpha1~3500 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dce910af3bb135bd6d7c5a4cc512043b3ad4acc1;p=thirdparty%2Fopenssl.git Fix ssl_free() and thus BIO_free() to respect BIO_NOCLOSE Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/16688) --- diff --git a/ssl/bio_ssl.c b/ssl/bio_ssl.c index 43747785f07..401178f0c2e 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);