Skip to content

Commit fd3c39e

Browse files
committed
Fix new coverity issue in BrokerRetained_Store
1 parent d3b6389 commit fd3c39e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/mqtt_broker.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,6 +1877,8 @@ static int BrokerRetained_Store(MqttBroker* broker, const char* topic,
18771877
XMEMSET(msg, 0, sizeof(*msg));
18781878
msg->topic = (char*)WOLFMQTT_MALLOC((size_t)tlen + 1);
18791879
if (msg->topic == NULL) {
1880+
WOLFMQTT_FREE(msg);
1881+
msg = NULL;
18801882
rc = MQTT_CODE_ERROR_MEMORY;
18811883
}
18821884
}

0 commit comments

Comments
 (0)