mirror of
https://github.com/espressif/openthread.git
synced 2026-08-18 00:19:52 +00:00
[meshcop] fix premature free of finalize message (#4487)
This commit fixes a bug that the finalize message will be prematurely freed if the joiner is started at the second time without waiting for the finish of the first initiation.
This commit is contained in:
@@ -163,11 +163,11 @@ void Joiner::Finish(otError aError)
|
||||
|
||||
case OT_JOINER_STATE_DISCOVER:
|
||||
Get<Coap::CoapSecure>().Stop();
|
||||
FreeJoinerFinalizeMessage();
|
||||
break;
|
||||
}
|
||||
|
||||
SetState(OT_JOINER_STATE_IDLE);
|
||||
FreeJoinerFinalizeMessage();
|
||||
|
||||
if (mCallback)
|
||||
{
|
||||
@@ -450,11 +450,13 @@ exit:
|
||||
|
||||
void Joiner::FreeJoinerFinalizeMessage(void)
|
||||
{
|
||||
if (mFinalizeMessage != NULL)
|
||||
{
|
||||
mFinalizeMessage->Free();
|
||||
mFinalizeMessage = NULL;
|
||||
}
|
||||
VerifyOrExit(mState == OT_JOINER_STATE_IDLE && mFinalizeMessage != NULL);
|
||||
|
||||
mFinalizeMessage->Free();
|
||||
mFinalizeMessage = NULL;
|
||||
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
void Joiner::SendJoinerFinalize(void)
|
||||
|
||||
Reference in New Issue
Block a user