Fix potential memory leak if failing to create mutex

Closes https://github.com/espressif/esp-idf/issues/4384
Closes IDFGH-2235
This commit is contained in:
Marius Vikhammer
2019-11-22 15:10:38 +08:00
committed by David Cermak
parent 9655845fdc
commit 9ca997d2d4

View File

@ -412,6 +412,7 @@ esp_mqtt_client_handle_t esp_mqtt_client_init(const esp_mqtt_client_config_t *co
}
client->api_lock = xSemaphoreCreateMutex();
if (!client->api_lock) {
free(client->event.error_handle);
free(client);
return NULL;
}