Skip to content

Commit 71e39df

Browse files
committed
Fixed memory leak for real this time.
1 parent 3327b25 commit 71e39df

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/AllThingsTalk_LTEM.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,13 @@ bool AllThingsTalk_LTEM::send(CborPayload &payload) {
197197
topic[length-1] = 0;
198198
if (mqtt.publish(topic, payload.getBytes(), payload.getSize(), 0, 0)) {
199199
debug("> Message Published to AllThingsTalk (CBOR)");
200+
delete topic;
200201
return true;
201202
} else {
202203
debug("> Failed to Publish Message to AllThingsTalk (CBOR)");
204+
delete topic;
203205
return false;
204206
}
205-
delete topic;
206207
}
207208
} else {
208209
debug("You're trying to send a message but you've disconnected from the network. Execute connect() to re-connect.");

0 commit comments

Comments
 (0)