mirror of
https://github.com/espressif/esp-idf.git
synced 2026-05-19 23:45:28 +02:00
fix(wifi): fix esp_wifi_scan_start memory leakage issue
Closes https://github.com/espressif/esp-idf/issues/10693
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user