From 3a89059271507a614b62c90e1175d5d5cbffe904 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 4 Feb 2020 17:11:11 +0000 Subject: [PATCH] Don't call SSL_shutdown() if SSL init hasn't completed. --- lib/net_mosq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/net_mosq.c b/lib/net_mosq.c index 4fbdd7ad..a0d837b8 100644 --- a/lib/net_mosq.c +++ b/lib/net_mosq.c @@ -199,7 +199,9 @@ int net__socket_close(struct mosquitto *mosq) #endif { if(mosq->ssl){ - SSL_shutdown(mosq->ssl); + if(!SSL_in_init(mosq->ssl)){ + SSL_shutdown(mosq->ssl); + } SSL_free(mosq->ssl); mosq->ssl = NULL; }