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

Appearance settings

Commit 3bf1e07

Browse filesBrowse files
mrengineer7777me-no-dev
authored andcommitted
WiFiUDF Low memory fix (espressif#8065)
Fixed library crash on low memory where `new char[1460];` throws an exception. `malloc` is a safe drop in replacement.
1 parent 5ebe01f commit 3bf1e07
Copy full SHA for 3bf1e07

File tree

1 file changed

+3
-3
lines changed
Filter options

1 file changed

+3
-3
lines changed

‎libraries/WiFi/src/WiFiUdp.cpp

Copy file name to clipboardExpand all lines: libraries/WiFi/src/WiFiUdp.cpp
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ uint8_t WiFiUDP::begin(IPAddress address, uint16_t port){
4444

4545
server_port = port;
4646

47-
tx_buffer = new char[1460];
47+
tx_buffer = (char *)malloc(1460);
4848
if(!tx_buffer){
4949
log_e("could not create tx buffer: %d", errno);
5050
return 0;
@@ -100,7 +100,7 @@ uint8_t WiFiUDP::beginMulticast(IPAddress a, uint16_t p){
100100

101101
void WiFiUDP::stop(){
102102
if(tx_buffer){
103-
delete[] tx_buffer;
103+
free(tx_buffer);
104104
tx_buffer = NULL;
105105
}
106106
tx_buffer_len = 0;
@@ -136,7 +136,7 @@ int WiFiUDP::beginPacket(){
136136

137137
// allocate tx_buffer if is necessary
138138
if(!tx_buffer){
139-
tx_buffer = new char[1460];
139+
tx_buffer = (char *)malloc(1460);
140140
if(!tx_buffer){
141141
log_e("could not create tx buffer: %d", errno);
142142
return 0;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.