From 47a2b4b6b785b502adaf2ce972e28ed0b6b41edc Mon Sep 17 00:00:00 2001 From: dan-du-car Date: Mon, 15 Apr 2024 18:05:21 +0000 Subject: [PATCH] address comments --- .../TelematicBridgePlugin/src/TelematicBridgeMsgWorker.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/v2i-hub/TelematicBridgePlugin/src/TelematicBridgeMsgWorker.h b/src/v2i-hub/TelematicBridgePlugin/src/TelematicBridgeMsgWorker.h index 5c24f8305..ec67f8432 100644 --- a/src/v2i-hub/TelematicBridgePlugin/src/TelematicBridgeMsgWorker.h +++ b/src/v2i-hub/TelematicBridgePlugin/src/TelematicBridgeMsgWorker.h @@ -241,9 +241,8 @@ namespace TelematicBridge else { // Render a cJSON entity to text for transfer/storage. Free the char* when finished. - char * payloadPtr = cJSON_Print(msg->payload); - json["payload"] = StringToJson(payloadPtr); - free(payloadPtr); + auto payloadPtr = std::make_unique(cJSON_Print(msg->payload)); + json["payload"] = StringToJson(*payloadPtr); } }