Null-check packet allocations in allocForSending and its callers (#11086)

* Null-check packet allocations in allocForSending and its callers

Sibling of 0ae44d701.

* Null-check allocDataProtobuf, allocAckNak and allocErrorResponse callers

Second tier of the same nullable contract.

* Keep telemetry sleep scheduling on allocation failure

Allocation failure now marks the telemetry invalid instead of returning
early, so power-saving SENSOR nodes still arm deep sleep.
This commit is contained in:
Thomas Göttgens
2026-07-20 18:37:13 -05:00
committed by GitHub
parent 09de848fbe
commit fb75410e53
30 changed files with 194 additions and 86 deletions
+4
View File
@@ -169,6 +169,8 @@ bool KeyVerificationModule::sendInitialRequest(NodeNum remoteNode)
KeyVerification.hash1.size = 32;
memcpy(KeyVerification.hash1.bytes, owner.public_key.bytes, 32);
meshtastic_MeshPacket *p = allocDataProtobuf(KeyVerification);
if (!p)
return false;
p->to = remoteNode;
p->channel = 0;
// Only request PKI when we already hold the destination's key. Otherwise this first message goes out
@@ -325,6 +327,8 @@ void KeyVerificationModule::processSecurityNumber(uint32_t incomingNumber)
KeyVerification.hash1.size = 32;
memcpy(KeyVerification.hash1.bytes, hash1, 32);
meshtastic_MeshPacket *p = allocDataProtobuf(KeyVerification);
if (!p)
return;
p->to = currentRemoteNode;
p->channel = 0;
p->pki_encrypted = true;