From 813ba311c5c9dc0224752dab0214b5b5426e0129 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 20 Oct 2025 14:31:02 -0700 Subject: openssl - handle NULL SSL object --- src/supplemental/tls/openssl/openssl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/supplemental/tls') diff --git a/src/supplemental/tls/openssl/openssl.c b/src/supplemental/tls/openssl/openssl.c index 3a32946a..69364dd1 100644 --- a/src/supplemental/tls/openssl/openssl.c +++ b/src/supplemental/tls/openssl/openssl.c @@ -220,7 +220,10 @@ ossl_init_nng(void) static void ossl_conn_fini(nng_tls_engine_conn *ec) { - SSL_free(ec->ssl); + if (ec->ssl != NULL) { + SSL_free(ec->ssl); + ec->ssl = NULL; + } } static int @@ -274,7 +277,9 @@ ossl_conn_init(nng_tls_engine_conn *ec, void *tls, nng_tls_engine_config *cfg, static void ossl_conn_close(nng_tls_engine_conn *ec) { - (void) SSL_shutdown(ec->ssl); + if (ec->ssl != NULL) { + (void) SSL_shutdown(ec->ssl); + } } static int -- cgit v1.2.3-70-g09d2