Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PacketBufferHandle::IsNull] Missing null check after calling PacketB… #25521

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,27 @@ namespace UserDirectedCommissioning {
CHIP_ERROR UserDirectedCommissioningClient::SendUDCMessage(TransportMgrBase * transportMgr, System::PacketBufferHandle && payload,
chip::Transport::PeerAddress peerAddress)
{
CHIP_ERROR err = EncodeUDCMessage(payload);
if (err != CHIP_NO_ERROR)
{
return err;
}
ReturnErrorOnFailure(EncodeUDCMessage(payload));

ChipLogProgress(Inet, "Sending UDC msg");

// send UDC message 5 times per spec (no ACK on this message)
for (unsigned int i = 0; i < 5; i++)
{
err = transportMgr->SendMessage(peerAddress, payload.CloneData());
auto msgCopy = payload.CloneData();
VerifyOrReturnError(!msgCopy.IsNull(), CHIP_ERROR_NO_MEMORY);

auto err = transportMgr->SendMessage(peerAddress, std::move(msgCopy));
if (err != CHIP_NO_ERROR)
{
ChipLogError(AppServer, "UDC SendMessage failed: %" CHIP_ERROR_FORMAT, err.Format());
return err;
}
sleep(1);
}
ChipLogProgress(Inet, "UDC msg send status %" CHIP_ERROR_FORMAT, err.Format());
return err;

ChipLogProgress(Inet, "UDC msg sent");
return CHIP_NO_ERROR;
}

CHIP_ERROR UserDirectedCommissioningClient::EncodeUDCMessage(const System::PacketBufferHandle & payload)
Expand Down