Skip to content

Commit

Permalink
Memory leak (#1672)
Browse files Browse the repository at this point in the history
When a package of size 0 arrives, "buf" is created, but never released. (Sorry, that was my mistake in the last patch)
  • Loading branch information
Schuemi authored and me-no-dev committed Jul 25, 2018
1 parent 7761ebd commit 328523f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libraries/WiFi/src/WiFiUdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,10 @@ int WiFiUDP::parsePacket(){
}
remote_ip = IPAddress(si_other.sin_addr.s_addr);
remote_port = ntohs(si_other.sin_port);
if (len == 0) return 0;
rx_buffer = new cbuf(len);
rx_buffer->write(buf, len);
if (len > 0) {
rx_buffer = new cbuf(len);
rx_buffer->write(buf, len);
}
delete[] buf;
return len;
}
Expand Down

0 comments on commit 328523f

Please sign in to comment.