Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions libraries/WiFi/src/WiFiUdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ int WiFiUDP::parsePacket(){
return 0;
struct sockaddr_in si_other;
int slen = sizeof(si_other) , len;
char * buf = new char[1460];
if(!buf){
char *buf = (char *)malloc(1460);
if(!buf) {
return 0;
}
if ((len = recvfrom(udp_server, buf, 1460, MSG_DONTWAIT, (struct sockaddr *) &si_other, (socklen_t *)&slen)) == -1){
delete[] buf;
free(buf);
if(errno == EWOULDBLOCK){
return 0;
}
Expand All @@ -225,7 +225,7 @@ int WiFiUDP::parsePacket(){
rx_buffer = new cbuf(len);
rx_buffer->write(buf, len);
}
delete[] buf;
free(buf);
return len;
}

Expand Down