mirror of
https://github.com/espressif/openthread.git
synced 2026-07-30 07:37:46 +00:00
[coap] add message free on error in Cli::CoapSecure::DefaultHandler (#4193)
This commit is contained in:
@@ -558,8 +558,8 @@ void CoapSecure::DefaultHandler(void *aContext, otMessage *aMessage, const otMes
|
||||
|
||||
void CoapSecure::DefaultHandler(otMessage *aMessage, const otMessageInfo *aMessageInfo)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
otMessage *responseMessage;
|
||||
otError error = OT_ERROR_NONE;
|
||||
otMessage *responseMessage = NULL;
|
||||
|
||||
if ((otCoapMessageGetType(aMessage) == OT_COAP_TYPE_CONFIRMABLE) ||
|
||||
(otCoapMessageGetCode(aMessage) == OT_COAP_CODE_GET))
|
||||
@@ -576,7 +576,10 @@ void CoapSecure::DefaultHandler(otMessage *aMessage, const otMessageInfo *aMessa
|
||||
}
|
||||
|
||||
exit:
|
||||
return;
|
||||
if (error != OT_ERROR_NONE && responseMessage != NULL)
|
||||
{
|
||||
otMessageFree(responseMessage);
|
||||
}
|
||||
}
|
||||
#endif // CLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER
|
||||
|
||||
|
||||
Reference in New Issue
Block a user