mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-03 12:20:43 +00:00
AvOid memleak
This commit is contained in:
parent
439534f1fb
commit
0a5263a4aa
@ -105,12 +105,12 @@ void NeighborInfoModule::sendNeighborInfo(NodeNum dest, bool wantReplies)
|
|||||||
{
|
{
|
||||||
meshtastic_NeighborInfo neighborInfo = meshtastic_NeighborInfo_init_zero;
|
meshtastic_NeighborInfo neighborInfo = meshtastic_NeighborInfo_init_zero;
|
||||||
collectNeighborInfo(&neighborInfo);
|
collectNeighborInfo(&neighborInfo);
|
||||||
|
// only send neighbours if we have some to send
|
||||||
|
if (neighborInfo.neighbors_count > 0) {
|
||||||
meshtastic_MeshPacket *p = allocDataProtobuf(neighborInfo);
|
meshtastic_MeshPacket *p = allocDataProtobuf(neighborInfo);
|
||||||
p->to = dest;
|
p->to = dest;
|
||||||
p->decoded.want_response = wantReplies;
|
p->decoded.want_response = wantReplies;
|
||||||
p->priority = meshtastic_MeshPacket_Priority_BACKGROUND;
|
p->priority = meshtastic_MeshPacket_Priority_BACKGROUND;
|
||||||
// only send neighbours if we have some to send
|
|
||||||
if (neighborInfo.neighbors_count > 0) {
|
|
||||||
printNeighborInfo("SENDING", &neighborInfo);
|
printNeighborInfo("SENDING", &neighborInfo);
|
||||||
service->sendToMesh(p, RX_SRC_LOCAL, true);
|
service->sendToMesh(p, RX_SRC_LOCAL, true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user