From: David Cermak Date: Fri, 15 Feb 2019 12:23:21 +0000 (+0100) Subject: mdns: fix possible crash when mdns_free called while action queue not empty X-Git-Tag: v3.3-beta2~33^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=206b47c03aca0acdf40d1d9c250e18aeddfe1bd7;p=esp-idf mdns: fix possible crash when mdns_free called while action queue not empty --- diff --git a/components/mdns/mdns.c b/components/mdns/mdns.c index 1bce6db43f..cf16ae6561 100644 --- a/components/mdns/mdns.c +++ b/components/mdns/mdns.c @@ -4017,8 +4017,6 @@ 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; @@ -4031,6 +4029,8 @@ static esp_err_t _mdns_service_task_stop() vTaskDelay(10 / portTICK_PERIOD_MS); } } + vSemaphoreDelete(_mdns_service_semaphore); + _mdns_service_semaphore = NULL; return ESP_OK; }