mqtt: Fix missing MQTT_API_UNLOCK in esp_mqtt_client_stop error path

Fixes: 5e17dcaeb2 ("MQTT: Fix esp_mqtt_client_stop deadlock")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
This commit is contained in:
Axel Lin
2020-11-09 16:04:27 +08:00
parent d6613e995b
commit 845c2a3a1e

View File

@ -1494,6 +1494,7 @@ esp_err_t esp_mqtt_client_stop(esp_mqtt_client_handle_t client)
/* A running client cannot be stopped from the MQTT task/event handler */
TaskHandle_t running_task = xTaskGetCurrentTaskHandle();
if (running_task == client->task_handle) {
MQTT_API_UNLOCK(client);
ESP_LOGE(TAG, "Client cannot be stopped from MQTT task");
return ESP_FAIL;
}