fix(wifi): fix esp_wifi_scan_start memory leakage issue

Closes https://github.com/espressif/esp-idf/issues/10693
This commit is contained in:
muhaidong
2024-02-03 16:29:26 +08:00
parent ffd01bf73b
commit d0afffe8c9
7 changed files with 8 additions and 8 deletions

View File

@@ -802,6 +802,7 @@ static esp_err_t update_wifi_scan_results(void)
prov_ctx->ap_list[curr_channel] = (wifi_ap_record_t *) calloc(get_count, sizeof(wifi_ap_record_t));
if (!prov_ctx->ap_list[curr_channel]) {
ESP_LOGE(TAG, "Failed to allocate memory for AP list");
esp_wifi_clear_ap_list();
goto exit;
}
if (esp_wifi_scan_get_ap_records(&get_count, prov_ctx->ap_list[curr_channel]) != ESP_OK) {

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -66,13 +66,10 @@ static void handle_wnm_scan_done(struct wpa_supplicant *wpa_s)
static void scan_done_cleanup(struct wpa_supplicant *wpa_s)
{
uint16_t number = 1;
wifi_ap_record_t ap_records;
wpa_s->scanning = 0;
wpa_s->scan_reason = 0;
/* clean scan list from net80211 */
esp_wifi_scan_get_ap_records(&number, &ap_records);
esp_wifi_clear_ap_list();
}
void esp_supplicant_handle_scan_done_evt(void)