Skip to content

Commit 94025ed

Browse files
Update WiFiUdp.cpp
1 parent 8873adb commit 94025ed

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libraries/WiFi/src/WiFiUdp.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,12 @@ int WiFiUDP::parsePacket(){
207207
return 0;
208208
struct sockaddr_in si_other;
209209
int slen = sizeof(si_other) , len;
210-
char * buf = new char[1460];
211-
if(!buf){
210+
char *buf = (char *)malloc(1460);
211+
if(!buf) {
212212
return 0;
213213
}
214214
if ((len = recvfrom(udp_server, buf, 1460, MSG_DONTWAIT, (struct sockaddr *) &si_other, (socklen_t *)&slen)) == -1){
215-
delete[] buf;
215+
free(buf);
216216
if(errno == EWOULDBLOCK){
217217
return 0;
218218
}
@@ -225,7 +225,7 @@ int WiFiUDP::parsePacket(){
225225
rx_buffer = new cbuf(len);
226226
rx_buffer->write(buf, len);
227227
}
228-
delete[] buf;
228+
free(buf);
229229
return len;
230230
}
231231

0 commit comments

Comments
 (0)