Coap fixes (#1606)

* Fixes segmentation fault in POSIX version by removing coap message initialisation with NULL header

* Alters API so that there will be no attempt to create messages with NULL header
This commit is contained in:
CampbellWray
2017-04-17 21:25:58 -07:00
committed by Jonathan Hui
parent f4c40f4c8a
commit 681fff9f94
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -260,7 +260,7 @@ exit:
ThreadError Coap::ProcessClient(int argc, char *argv[])
{
ThreadError error = kThreadError_None;
otMessage *message = otCoapNewMessage(sInstance, NULL);
otMessage *message = NULL;
otMessageInfo messageInfo;
otCoapHeader header;
+5 -1
View File
@@ -126,7 +126,11 @@ const otCoapOption *otCoapHeaderGetNextOption(otCoapHeader *aHeader)
otMessage *otCoapNewMessage(otInstance *aInstance, const otCoapHeader *aHeader)
{
return aInstance->mThreadNetif.GetCoapClient().NewMessage(*(static_cast<const Coap::Header *>(aHeader)));
Message *message;
VerifyOrExit(aHeader != NULL, message = NULL);
message = aInstance->mThreadNetif.GetCoapClient().NewMessage(*(static_cast<const Coap::Header *>(aHeader)));
exit:
return message;
}
ThreadError otCoapSendRequest(otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo,