Merge branch 'bugfix/fix_wifi_deinit_memory_leak_v4.0' into 'release/v4.0'
esp_wifi: fix WiFi deinit memory leak (backport v4.0) See merge request espressif/esp-idf!6539
This commit is contained in:
commit
4ed0d006b4
5 changed files with 44 additions and 2 deletions
|
@ -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 e0e387d9118a5e7c939b8025e8db680c5620a6a2
|
||||
Subproject commit e386debd1f288c59c4d07f41f4f3cac395388d51
|
|
@ -96,6 +96,21 @@ static void esp_wifi_set_debug_log()
|
|||
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue