esp_modem: Fixed modem netif deinit to clear IP events
Function esp_modem_netif_clear_default_handlers() didn't unregister
event handlers from IP related events, so if the netif modem was
reinitialized the previous handler was called with already destroyed
esp_netif handle.
Closes
@@ -144,6 +144,15 @@ esp_err_t esp_modem_netif_clear_default_handlers(void *h)
if (ret != ESP_OK) {
goto clear_event_failed;
}
+ ret = esp_event_handler_unregister(IP_EVENT, IP_EVENT_PPP_GOT_IP, esp_netif_action_connected);
+ if (ret != ESP_OK) {
+ goto clear_event_failed;
+ }
+ ret = esp_event_handler_unregister(IP_EVENT, IP_EVENT_PPP_LOST_IP, esp_netif_action_disconnected);
+ if (ret != ESP_OK) {
+ goto clear_event_failed;
+ }
+
return ESP_OK;
clear_event_failed:
