diff --git a/libraries/AsyncUDP/src/AsyncUDP.cpp b/libraries/AsyncUDP/src/AsyncUDP.cpp index 63ccc114..762529b9 100644 --- a/libraries/AsyncUDP/src/AsyncUDP.cpp +++ b/libraries/AsyncUDP/src/AsyncUDP.cpp @@ -682,8 +682,9 @@ void AsyncUDP::_recv(udp_pcb *upcb, pbuf *pb, const ip_addr_t *addr, uint16_t po if(_handler) { AsyncUDPPacket packet(this, this_pb, addr, port, netif); _handler(packet); + } else { + pbuf_free(this_pb); } - pbuf_free(this_pb); } }