Fix memory leak when reconnecting with TLS errors.

Fix memory leak that occurred if mosquitto_reconnect() was used when TLS
errors were present.

Closes #592. Thanks to smartdabao and aaronovz1.
This commit is contained in:
Roger A. Light 2018-10-23 10:46:55 +01:00
parent 35dea07dcd
commit 0a9ee5b4cf
2 changed files with 11 additions and 0 deletions

View File

@ -1,3 +1,11 @@
1.5.4 - 201810xx
================
Library:
- Fix memory leak that occurred if mosquitto_reconnect() was used when TLS
errors were present. Closes #592.
1.5.3 - 20180925
================

View File

@ -596,6 +596,9 @@ int net__socket_connect_step3(struct mosquitto *mosq, const char *host, uint16_t
if(rc) return rc;
if(mosq->ssl_ctx){
if(mosq->ssl){
SSL_free(mosq->ssl);
}
mosq->ssl = SSL_new(mosq->ssl_ctx);
if(!mosq->ssl){
COMPAT_CLOSE(mosq->sock);