Commit 328523f5 authored by Jan P. Schümann's avatar Jan P. Schümann Committed by Me No Dev

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)
parent 7761ebd9
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment