Merge pull request #2295 from meshtastic/2228-bug-heap-leak-in-rangetestmodule

tryfix #2228 as suggested by @mverch67
This commit is contained in:
Thomas Göttgens 2023-02-21 20:40:20 +01:00 committed by GitHub
commit 9fc18c2a19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -148,7 +148,11 @@ 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
if (old->packet)
packetPool.release(old->packet);
return true;
} else
return false;