]> granicus.if.org Git - esp-idf/commitdiff
mdns: fix possible crash when mdns_free called while action queue not empty
authorDavid Cermak <cermak@espressif.com>
Fri, 15 Feb 2019 12:23:21 +0000 (13:23 +0100)
committerDavid Cermak <cermak@espressif.com>
Fri, 15 Feb 2019 12:23:21 +0000 (13:23 +0100)
components/mdns/mdns.c

index 1bce6db43fe61993d6c0dd625410eb0c945ca652..cf16ae65617e2cca02104e646a0d389781e12270 100644 (file)
@@ -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;
 }