mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-25 01:42:15 +00:00
fix heap use after delete (#3373)
This commit is contained in:
parent
c80098f517
commit
e16689a0d6
@ -167,8 +167,6 @@ bool ReliableRouter::stopRetransmission(GlobalPacketId key)
|
|||||||
auto old = findPendingPacket(key);
|
auto old = findPendingPacket(key);
|
||||||
if (old) {
|
if (old) {
|
||||||
auto p = old->packet;
|
auto p = old->packet;
|
||||||
auto numErased = pending.erase(key);
|
|
||||||
assert(numErased == 1);
|
|
||||||
/* Only when we already transmitted a packet via LoRa, we will cancel the packet in the Tx queue
|
/* Only when we already transmitted a packet via LoRa, we will cancel the packet in the Tx queue
|
||||||
to avoid canceling a transmission if it was ACKed super fast via MQTT */
|
to avoid canceling a transmission if it was ACKed super fast via MQTT */
|
||||||
if (old->numRetransmissions < NUM_RETRANSMISSIONS - 1) {
|
if (old->numRetransmissions < NUM_RETRANSMISSIONS - 1) {
|
||||||
@ -177,6 +175,8 @@ bool ReliableRouter::stopRetransmission(GlobalPacketId key)
|
|||||||
// now free the pooled copy for retransmission too
|
// now free the pooled copy for retransmission too
|
||||||
packetPool.release(p);
|
packetPool.release(p);
|
||||||
}
|
}
|
||||||
|
auto numErased = pending.erase(key);
|
||||||
|
assert(numErased == 1);
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user