From 2e80a4ed87786331bdf6aa38c2473a0ea0f4cd13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 21 Feb 2023 14:53:27 +0100 Subject: [PATCH 1/2] tryfix #2228 as suggested by @mverch67 --- src/mesh/ReliableRouter.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesh/ReliableRouter.cpp b/src/mesh/ReliableRouter.cpp index 8000926f3..c973fd0c2 100644 --- a/src/mesh/ReliableRouter.cpp +++ b/src/mesh/ReliableRouter.cpp @@ -148,7 +148,10 @@ bool ReliableRouter::stopRetransmission(GlobalPacketId key) if (old) { auto numErased = pending.erase(key); assert(numErased == 1); + // remove the 'original' (identified by originator and packet->id) from the txqueue and free it cancelSending(getFrom(old->packet), old->packet->id); + // now free the pooled copy for retransmission too. tryfix for #2228 + packetPool.release(old->packet); return true; } else return false; From d830398fc561d0959e505ca68b6a87471d73bc81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 21 Feb 2023 20:01:56 +0100 Subject: [PATCH 2/2] Check if there's something there before we free it --- src/mesh/ReliableRouter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesh/ReliableRouter.cpp b/src/mesh/ReliableRouter.cpp index c973fd0c2..3d07ff77e 100644 --- a/src/mesh/ReliableRouter.cpp +++ b/src/mesh/ReliableRouter.cpp @@ -151,7 +151,8 @@ bool ReliableRouter::stopRetransmission(GlobalPacketId key) // remove the 'original' (identified by originator and packet->id) from the txqueue and free it cancelSending(getFrom(old->packet), old->packet->id); // now free the pooled copy for retransmission too. tryfix for #2228 - packetPool.release(old->packet); + if (old->packet) + packetPool.release(old->packet); return true; } else return false;