esp_wifi: fix WiFi deinit memory leak

pull/4345/head
liu zhifu 2019-10-24 17:11:30 +08:00
rodzic 9afba2abf5
commit b09624e89a
5 zmienionych plików z 44 dodań i 2 usunięć

Wyświetl plik

@ -102,6 +102,23 @@ typedef enum {
*/
esp_err_t esp_wifi_init_internal(const wifi_init_config_t *config);
/**
* @brief Deinitialize Wi-Fi Driver
* Free resource for WiFi driver, such as WiFi control structure, RX/TX buffer,
* WiFi NVS structure among others.
*
* For the most part, you need not call this function directly. It gets called
* from esp_wifi_deinit().
*
* This function may be called, if you call esp_wifi_init_internal to initialize
* WiFi driver.
*
* @return
* - ESP_OK: succeed
* - others: refer to error code esp_err.h
*/
esp_err_t esp_wifi_deinit_internal(void);
/**
* @brief get whether the wifi driver is allowed to transmit data or not
*

@ -1 +1 @@
Subproject commit 4a7e5493e7af7eb9785baf5f5d55fa12f23155c4
Subproject commit d38f75b16016636734eb747e0706c9f62d3d5e93

Wyświetl plik

@ -98,6 +98,21 @@ static void esp_wifi_set_debug_log(void)
}
esp_err_t esp_wifi_deinit(void)
{
esp_err_t err = ESP_OK;
esp_supplicant_deinit();
err = esp_wifi_deinit_internal();
if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to deinit Wi-Fi driver (0x%x)", err);
}
tcpip_adapter_clear_default_wifi_handlers();
return err;
}
esp_err_t esp_wifi_init(const wifi_init_config_t *config)
{
#ifdef CONFIG_PM_ENABLE

Wyświetl plik

@ -54,6 +54,16 @@ const mesh_crypto_funcs_t g_wifi_default_mesh_crypto_funcs;
*/
esp_err_t esp_supplicant_init(void);
/**
* @brief Supplicant deinitialization
*
* @return
* - ESP_OK : succeed
* - others: failed
*/
esp_err_t esp_supplicant_deinit(void);
/**
* @}
*/

Wyświetl plik

@ -232,7 +232,7 @@ int esp_supplicant_init(void)
return ESP_OK;
}
bool wpa_hook_deinit(void)
int esp_supplicant_deinit(void)
{
return esp_wifi_unregister_wpa_cb_internal();
}