MQTT IotMqtt_Subscribe memory leak

Hi all

I am still testing MQTT, now by connecting, subscribing to topics, and then closing the connection. I have memory leaks, one for each topic, with size = topicFilterLength. That made it relatively easy to find the cause…

IotMqtt_Subscribe() calls _IotMqtt_AddSubscriptions() where

pTopicFilter = IotMqtt_MallocMessage( pSubscriptionList[ i ].topicFilterLength );

IotMqtt_MallocMessage is pvPortMalloc.

I can’t find any place where pTopicFilter is again free-ed.

Am I doing something wrong (i.e. should I remove subscriptions before I close MQTT or when I receive a disconnect callback) or is this bug?

Thanks

W

Hi @wrm,

The topic filter is freed when removing the subscription. This was fixed recently in PR 3072, and you can pull the latest commit from the master branch for the updated code.

Thank you