Skip to content

Commit 411af08

Browse files
committed
WiFi: fix memory leak in scanNetworks()
1 parent 4ceaad7 commit 411af08

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libraries/WiFi/src/WiFi.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ int8_t arduino::WiFiClass::scanNetworks() {
215215
connected_ap = SSID_MAX_COUNT;
216216
uint8_t count = SSID_MAX_COUNT;
217217
if (ap_list != nullptr) {
218-
free(ap_list);
218+
delete[]ap_list;
219+
ap_list = nullptr;
219220
}
220221
ap_list = new WiFiAccessPoint[count];
221222
return wifi_if->scan(ap_list, count);

0 commit comments

Comments
 (0)