Fix possible memory leak with bridges and SSL.

Fix possible memory leak if bridge using SSL attempts to connect to a
host that is not up.

Thanks to Ed Morris.
This commit is contained in:
Roger A. Light 2015-10-12 14:48:52 +01:00
parent 89763a51d9
commit 26eac3c1ca
2 changed files with 5 additions and 0 deletions

View File

@ -1,3 +1,7 @@
Broker:
- Fix possible memory leak if bridge using SSL attempts to connect to a
host that is not up.
Clients:
- "mosquitto_pub -l" now no longer limited to 1024 byte lines. Closes #478917.

View File

@ -211,6 +211,7 @@ int mqtt3_bridge_connect(struct mosquitto_db *db, struct mosquitto *context)
rc = _mosquitto_socket_connect(context, context->bridge->addresses[context->bridge->cur_address].address, context->bridge->addresses[context->bridge->cur_address].port, NULL, false);
if(rc > 0 ){
if(rc == MOSQ_ERR_TLS){
_mosquitto_socket_close(db, context);
return rc; /* Error already printed */
}else if(rc == MOSQ_ERR_ERRNO){
_mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Error creating bridge: %s.", strerror(errno));