Fix heap leak mentioned in #2358 (#2359)

* Fix heap leak mentioned in #2358

* Additional fix for #2359
This commit is contained in:
Manuel
2023-03-14 22:50:32 +01:00
committed by GitHub
parent e03a2f8f7f
commit b398f31b64

View File

@@ -82,7 +82,7 @@ int MeshService::handleFromRadio(const meshtastic_MeshPacket *mp)
}
printPacket("Forwarding to phone", mp);
sendToPhone((meshtastic_MeshPacket *)mp);
sendToPhone(packetPool.allocCopy(*mp));
return 0;
}
@@ -231,7 +231,7 @@ void MeshService::sendToMesh(meshtastic_MeshPacket *p, RxSource src, bool ccToPh
}
if (ccToPhone) {
sendToPhone(p);
sendToPhone(packetPool.allocCopy(*p));
}
}
@@ -262,9 +262,8 @@ void MeshService::sendToPhone(meshtastic_MeshPacket *p)
releaseToPool(d);
}
meshtastic_MeshPacket *copied = packetPool.allocCopy(*p);
perhapsDecode(copied);
assert(toPhoneQueue.enqueue(copied, 0));
perhapsDecode(p);
assert(toPhoneQueue.enqueue(p, 0));
fromNum++;
}