diff --git a/src/inet/TCPEndPoint.cpp b/src/inet/TCPEndPoint.cpp index 91c70fdc686505..7c31e74e8e8e99 100644 --- a/src/inet/TCPEndPoint.cpp +++ b/src/inet/TCPEndPoint.cpp @@ -1086,7 +1086,13 @@ err_t TCPEndPoint::LwIPHandleDataReceived(void * arg, struct tcp_pcb * tpcb, str res = ERR_ABRT; if (res != ERR_OK) + { + if (p != nullptr) + { + pbuf_free(p); + } tcp_abort(tpcb); + } return res; }