mirror of
https://github.com/espressif/openthread.git
synced 2026-08-03 01:17:46 +00:00
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:
committed by
Jonathan Hui
parent
f4c40f4c8a
commit
681fff9f94
@@ -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;
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user