From 15cd25c3e90d411f0f72723d085f6773b28f8e4b Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 24 Mar 2022 13:59:00 +0000 Subject: [PATCH] Fix Coverity Scan 1486949 Resource leak --- lib/handle_pubackcomp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/handle_pubackcomp.c b/lib/handle_pubackcomp.c index 796a4b14..05f776be 100644 --- a/lib/handle_pubackcomp.c +++ b/lib/handle_pubackcomp.c @@ -138,10 +138,14 @@ int handle__pubackcomp(struct mosquitto *mosq, const char *type) /* Only inform the client the message has been sent once. */ callback__on_publish(mosq, mid, reason_code, properties); mosquitto_property_free_all(&properties); - }else if(rc != MOSQ_ERR_NOT_FOUND){ + }else{ mosquitto_property_free_all(&properties); - return rc; + + if(rc != MOSQ_ERR_NOT_FOUND){ + return rc; + } } + pthread_mutex_lock(&mosq->msgs_out.mutex); message__release_to_inflight(mosq, mosq_md_out); pthread_mutex_unlock(&mosq->msgs_out.mutex);