Skip to content

Commit

Permalink
(wpa_supplicant) : Fixed a memory leak issue created when parsing sca…
Browse files Browse the repository at this point in the history
…n results
  • Loading branch information
jgujarathi committed Nov 11, 2022
1 parent dbcf640 commit 561cce9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions components/wpa_supplicant/esp_supplicant/src/esp_wps.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,13 +397,17 @@ wps_parse_scan_result(struct wps_scan_ie *scan)
for (count = 0; count < WPS_MAX_DIS_AP_NUM; count++) {
if (os_memcmp(sm->dis_ap_list[count].bssid, scan->bssid, ETH_ALEN) == 0) {
wpa_printf(MSG_INFO, "discard ap bssid "MACSTR, MAC2STR(scan->bssid));
wpabuf_free(buf);
return false;
}
}
}

if (ap_found || sm->ignore_sel_reg) {
wpabuf_free(buf);
if (scan->ssid[1] > SSID_MAX_LEN) {
return false;
}
esp_wifi_enable_sta_privacy_internal();
os_memset(sm->ssid[0], 0, SSID_MAX_LEN);
os_memcpy(sm->ssid[0], (char *)&scan->ssid[2], (int)scan->ssid[1]);
Expand Down Expand Up @@ -1470,6 +1474,9 @@ wifi_station_wps_init(void)
sm->dev = NULL;
}
if (sm->wps_ctx) {
if (sm->wps_ctx->dh_privkey) {
wpabuf_free(sm->wps_ctx->dh_privkey);
}
os_free(sm->wps_ctx);
sm->wps_ctx = NULL;
}
Expand Down Expand Up @@ -1519,6 +1526,9 @@ wifi_station_wps_deinit(void)
sm->dev = NULL;
}
if (sm->wps_ctx) {
if (sm->wps_ctx->dh_privkey) {
wpabuf_free(sm->wps_ctx->dh_privkey);
}
os_free(sm->wps_ctx);
sm->wps_ctx = NULL;
}
Expand Down

0 comments on commit 561cce9

Please sign in to comment.