mdns: fix crash after init if no memory for task

mdns init first starts timer task, then starts service task. if service task failed to be created, timer task needs to be stopped too.
fixed https://ezredmine.espressif.cn:8765/issues/28466
This commit is contained in:
David Cermak 2019-01-25 16:17:07 +01:00
parent fd29b0165f
commit 1a53334843

View file

@ -3993,7 +3993,10 @@ static esp_err_t _mdns_service_task_start()
if (!_mdns_service_task_handle) {
xTaskCreatePinnedToCore(_mdns_service_task, "mdns", MDNS_SERVICE_STACK_DEPTH, NULL, 1, (TaskHandle_t * const)(&_mdns_service_task_handle), 0);
if (!_mdns_service_task_handle) {
_mdns_stop_timer();
MDNS_SERVICE_UNLOCK();
vSemaphoreDelete(_mdns_service_semaphore);
_mdns_service_semaphore = NULL;
return ESP_FAIL;
}
}
@ -4012,6 +4015,8 @@ static esp_err_t _mdns_service_task_stop()
MDNS_SERVICE_LOCK();
_mdns_stop_timer();
MDNS_SERVICE_UNLOCK();
vSemaphoreDelete(_mdns_service_semaphore);
_mdns_service_semaphore = NULL;
if (_mdns_service_task_handle) {
mdns_action_t action;
mdns_action_t * a = &action;