mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-14 14:31:24 +00:00
Fix memory leak in NextHopRouter: always free packet copy when removing from pending
This commit is contained in:
parent
ac4bcd2f56
commit
962e5d513c
@ -175,12 +175,18 @@ bool NextHopRouter::stopRetransmission(GlobalPacketId key)
|
||||
config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER_LATE)) {
|
||||
// remove the 'original' (identified by originator and packet->id) from the txqueue and free it
|
||||
cancelSending(getFrom(p), p->id);
|
||||
// now free the pooled copy for retransmission too
|
||||
packetPool.release(p);
|
||||
}
|
||||
}
|
||||
|
||||
// Regardless of whether or not we canceled this packet from the txQueue, remove it from our pending list so it doesn't
|
||||
// get scheduled again. (This is the core of stopRetransmission.)
|
||||
auto numErased = pending.erase(key);
|
||||
assert(numErased == 1);
|
||||
|
||||
// When we remove an entry from pending, always be sure to release the copy of the packet that was allocated in the call
|
||||
// to startRetransmission.
|
||||
packetPool.release(p);
|
||||
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user