Skip to content

Commit

Permalink
Update UDPEndPointImplSockets.cpp
Browse files Browse the repository at this point in the history
Moved msg.IsNull check to beginning of SendMsgImpl
  • Loading branch information
s-mcclain committed Sep 7, 2022
1 parent 9cb6c1b commit 7b6c891
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/inet/UDPEndPointImplSockets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,16 @@ CHIP_ERROR UDPEndPointImplSockets::ListenImpl()

CHIP_ERROR UDPEndPointImplSockets::SendMsgImpl(const IPPacketInfo * aPktInfo, System::PacketBufferHandle && msg)
{
// Ensure packet buffer is not null
VerifyOrReturnError(!msg.IsNull(), CHIP_ERROR_NO_MEMORY);

// Make sure we have the appropriate type of socket based on the
// destination address.
ReturnErrorOnFailure(GetSocket(aPktInfo->DestAddress.Type()));

// Ensure the destination address type is compatible with the endpoint address type.
VerifyOrReturnError(mAddrType == aPktInfo->DestAddress.Type(), CHIP_ERROR_INVALID_ARGUMENT);

// Ensure packet buffer is not null
VerifyOrReturnError(!msg.IsNull(), CHIP_ERROR_NO_MEMORY);

// For now the entire message must fit within a single buffer.
VerifyOrReturnError(!msg->HasChainedBuffer(), CHIP_ERROR_MESSAGE_TOO_LONG);

Expand Down

0 comments on commit 7b6c891

Please sign in to comment.