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
@@ -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;
