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
committed by BOT
parent 181e305b52
commit 3a2f9feec3
7 changed files with 8 additions and 8 deletions
+1
View File
@@ -304,6 +304,7 @@ static bool wifi_perform_scan(const char *ssid, bool internal)
g_ap_list_buffer = malloc(g_scan_ap_num * sizeof(wifi_ap_record_t));
if (g_ap_list_buffer == NULL) {
ESP_LOGE(TAG_STA, "Failed to malloc buffer to print scan results");
esp_wifi_clear_ap_list();
return false;
}
+1
View File
@@ -79,6 +79,7 @@ static void scan_done_handler(void *arg, esp_event_base_t event_base,
ap_list_buffer = malloc(sta_number * sizeof(wifi_ap_record_t));
if (ap_list_buffer == NULL) {
ESP_LOGE(TAG, "Failed to malloc buffer to print scan results");
esp_wifi_clear_ap_list();
return;
}
+1 -3
View File
@@ -305,9 +305,7 @@ void neighbor_report_recv_cb(void *ctx, const uint8_t *report, size_t report_len
goto cleanup;
}
/* cleanup from net802.11 */
uint16_t number = 1;
wifi_ap_record_t ap_records;
esp_wifi_scan_get_ap_records(&number, &ap_records);
esp_wifi_clear_ap_list();
cand_list = 1;
}
/* send AP btm query, this will cause STA to roam as well */