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; }