Fix Coverity Scan 1436854 Resource leak

pull/2505/head
Roger A. Light 4 years ago
parent c70a925f29
commit 1771dd9941

@ -76,18 +76,14 @@ int handle__suback(struct mosquitto *mosq)
qos_count = (int)(mosq->in_packet.remaining_length - mosq->in_packet.pos);
granted_qos = mosquitto__malloc((size_t)qos_count*sizeof(int));
if(!granted_qos){
#ifdef WITH_BROKER
mosquitto_property_free_all(&properties);
#endif
return MOSQ_ERR_NOMEM;
}
while(mosq->in_packet.pos < mosq->in_packet.remaining_length){
rc = packet__read_byte(&mosq->in_packet, &qos);
if(rc){
mosquitto__FREE(granted_qos);
#ifdef WITH_BROKER
mosquitto_property_free_all(&properties);
#endif
return rc;
}
granted_qos[i] = (int)qos;

Loading…
Cancel
Save