summaryrefslogtreecommitdiffstats
path: root/ssl/bio_ssl.c
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2021-09-27 14:22:40 +0200
committerTomas Mraz <tomas@openssl.org>2021-10-04 10:59:06 +0200
commit0569756be7cda9d40a9e68bfb34980dcafccaae1 (patch)
treed8f53403253abae463c8f18de369d5972fe2011a /ssl/bio_ssl.c
parent64d0cdc0742f3a3376d8dc6606311ee01bdb2bad (diff)
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) (cherry picked from commit dce910af3bb135bd6d7c5a4cc512043b3ad4acc1)
Diffstat (limited to 'ssl/bio_ssl.c')
-rw-r--r--ssl/bio_ssl.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ssl/bio_ssl.c b/ssl/bio_ssl.c
index 43747785f0..401178f0c2 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);