fixed memory leak in MQTT extended log
This commit is contained in:
parent
133dc249c7
commit
369b236549
|
|
@ -395,12 +395,12 @@ void MQTTTaskTransmit(void *pvParameter)
|
|||
DSS.data_length,
|
||||
0, 0);
|
||||
}
|
||||
//else
|
||||
// ESP_LOGW(TAG, "MQTT client not initialized or disconnected");
|
||||
if (!DSS.keep_memory_onfinish)
|
||||
{
|
||||
free(DSS.raw_data_ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void start_mqtt()
|
||||
{
|
||||
|
|
@ -547,10 +547,11 @@ esp_err_t ExtendedLog(esp_log_level_t level, char *format, ...)
|
|||
strcpy(buf, time);
|
||||
strcat(buf, " ");
|
||||
strcat(buf, data);
|
||||
MQTT_DATA_SEND_STRUCT DSS;
|
||||
MQTT_DATA_SEND_STRUCT DSS = {0};
|
||||
ComposeTopic(DSS.topic, idx, "LOG", "UPLINK");
|
||||
DSS.raw_data_ptr = buf;
|
||||
DSS.data_length = strlen(buf);
|
||||
DSS.keep_memory_onfinish = false;
|
||||
if (xQueueSend(GetMQTTHandlesPool(idx)->mqtt_queue, &DSS, pdMS_TO_TICKS(0)) != pdPASS)
|
||||
free(buf);
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user