Memory leak (#1672)

When a package of size 0 arrives, "buf" is created, but never released. (Sorry, that was my mistake in the last patch)
This commit is contained in:
Jan P. Schümann 2018-07-25 12:56:41 +02:00 committed by Me No Dev
parent 7761ebd9f2
commit 328523f5e3

View File

@ -221,9 +221,10 @@ int WiFiUDP::parsePacket(){
} }
remote_ip = IPAddress(si_other.sin_addr.s_addr); remote_ip = IPAddress(si_other.sin_addr.s_addr);
remote_port = ntohs(si_other.sin_port); remote_port = ntohs(si_other.sin_port);
if (len == 0) return 0; if (len > 0) {
rx_buffer = new cbuf(len); rx_buffer = new cbuf(len);
rx_buffer->write(buf, len); rx_buffer->write(buf, len);
}
delete[] buf; delete[] buf;
return len; return len;
} }