From 71e39df591dd8469fafd93da643b1e41e769c58c Mon Sep 17 00:00:00 2001 From: epiller Date: Wed, 10 Mar 2021 09:46:30 +0100 Subject: [PATCH] Fixed memory leak for real this time. --- src/AllThingsTalk_LTEM.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/AllThingsTalk_LTEM.cpp b/src/AllThingsTalk_LTEM.cpp index 1bc7308..80f2bfa 100644 --- a/src/AllThingsTalk_LTEM.cpp +++ b/src/AllThingsTalk_LTEM.cpp @@ -197,12 +197,13 @@ bool AllThingsTalk_LTEM::send(CborPayload &payload) { topic[length-1] = 0; if (mqtt.publish(topic, payload.getBytes(), payload.getSize(), 0, 0)) { debug("> Message Published to AllThingsTalk (CBOR)"); + delete topic; return true; } else { debug("> Failed to Publish Message to AllThingsTalk (CBOR)"); + delete topic; return false; } - delete topic; } } else { debug("You're trying to send a message but you've disconnected from the network. Execute connect() to re-connect.");