|
|
@@ -355,6 +355,9 @@ int MQTT_Init() {
|
|
|
if (ret != ESP_OK)
|
|
|
{
|
|
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Could not register event (ret=" + std::to_string(ret) + ")!");
|
|
|
+ esp_mqtt_client_destroy(client);
|
|
|
+ client = NULL;
|
|
|
+ mqtt_connected = false;
|
|
|
mqtt_initialized = false;
|
|
|
return -1;
|
|
|
}
|
|
|
@@ -366,6 +369,9 @@ int MQTT_Init() {
|
|
|
if (ret != ESP_OK)
|
|
|
{
|
|
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Client start failed (retval=" + std::to_string(ret) + ")!");
|
|
|
+ esp_mqtt_client_destroy(client);
|
|
|
+ client = NULL;
|
|
|
+ mqtt_connected = false;
|
|
|
mqtt_initialized = false;
|
|
|
return -1;
|
|
|
}
|