From 4da1f15b4136002fa50bc5a2bb6be458a93d6b47 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Mon, 23 Nov 2020 23:39:43 +0000 Subject: [PATCH] Fix Coverity Scan errors. 1436854 1436844 --- lib/handle_suback.c | 7 ++++++- src/bridge.c | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/handle_suback.c b/lib/handle_suback.c index acc40389..494463dc 100644 --- a/lib/handle_suback.c +++ b/lib/handle_suback.c @@ -66,7 +66,12 @@ 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) return MOSQ_ERR_NOMEM; + 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){ diff --git a/src/bridge.c b/src/bridge.c index 0502f083..936c2392 100644 --- a/src/bridge.c +++ b/src/bridge.c @@ -404,6 +404,7 @@ int bridge__connect(struct mosquitto *context) return rc; } } + mosquitto__free(notification_topic); } }