Fix potential memory leaks.
Closes #1773. Closes #1774. Thanks to Yingpei Zeng.
This commit is contained in:
parent
618cd7006b
commit
94d04136f8
@ -19,6 +19,7 @@ Broker:
|
|||||||
than the generic "socket error".
|
than the generic "socket error".
|
||||||
- Don't try to start DLT logging if DLT unavailable, to avoid a long delay
|
- Don't try to start DLT logging if DLT unavailable, to avoid a long delay
|
||||||
when shutting down the broker. Closes #1735.
|
when shutting down the broker. Closes #1735.
|
||||||
|
- Fix potential memory leaks. Closes #1773. Closes #1774.
|
||||||
|
|
||||||
Client library:
|
Client library:
|
||||||
- Improved documentation around connect callback return codes. Close #1730.
|
- Improved documentation around connect callback return codes. Close #1730.
|
||||||
|
@ -109,7 +109,10 @@ int handle__publish(struct mosquitto_db *db, struct mosquitto *context)
|
|||||||
/* Handle properties */
|
/* Handle properties */
|
||||||
if(context->protocol == mosq_p_mqtt5){
|
if(context->protocol == mosq_p_mqtt5){
|
||||||
rc = property__read_all(CMD_PUBLISH, &context->in_packet, &properties);
|
rc = property__read_all(CMD_PUBLISH, &context->in_packet, &properties);
|
||||||
if(rc) return rc;
|
if(rc){
|
||||||
|
mosquitto__free(topic);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
p = properties;
|
p = properties;
|
||||||
p_prev = NULL;
|
p_prev = NULL;
|
||||||
|
@ -119,6 +119,8 @@ int handle__subscribe(struct mosquitto_db *db, struct mosquitto *context)
|
|||||||
|
|
||||||
retain_handling = (subscription_options & 0x30);
|
retain_handling = (subscription_options & 0x30);
|
||||||
if(retain_handling == 0x30 || (subscription_options & 0xC0) != 0){
|
if(retain_handling == 0x30 || (subscription_options & 0xC0) != 0){
|
||||||
|
mosquitto__free(sub);
|
||||||
|
mosquitto__free(payload);
|
||||||
return MOSQ_ERR_PROTOCOL;
|
return MOSQ_ERR_PROTOCOL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user