Fix ssl_free() and thus BIO_free() to respect BIO_NOCLOSE

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16688)
This commit is contained in:
Dr. David von Oheimb 2021-09-27 14:22:40 +02:00 committed by Tomas Mraz
parent 19e277dd19
commit dce910af3b

View File

@ -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);