Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd9548c0

Browse files
authored
Merge pull request#1068 from pennam/giga-leak
WiFi: fix memory leak in scanNetworks()
2 parents22fa716 +b9163e5 commitd9548c0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

‎libraries/WiFi/src/WiFi.cpp‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,13 @@ int arduino::WiFiClass::setSSID(const char* ssid) {
214214

215215
int8_tarduino::WiFiClass::scanNetworks() {
216216
connected_ap = SSID_MAX_COUNT;
217-
uint8_t count = SSID_MAX_COUNT;
218217
if (ap_list !=nullptr) {
219-
free(ap_list);
218+
delete[]ap_list;
219+
ap_list =nullptr;
220220
}
221-
ap_list =new WiFiAccessPoint[count];
222-
return wifi_if->scan(ap_list, count);
221+
222+
ap_list =new WiFiAccessPoint[SSID_MAX_COUNT];
223+
return wifi_if->scan(ap_list, SSID_MAX_COUNT);
223224
}
224225

225226
char*arduino::WiFiClass::SSID(uint8_t networkItem) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp