Skip to content

Commit

Permalink
fix a memory leak bug about a registion update request without a reply
Browse files Browse the repository at this point in the history
  • Loading branch information
shan12138 committed Nov 13, 2024
1 parent e2ce38b commit 7fe7b0c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions core/registration.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,10 +857,17 @@ static void prv_handleRegistrationUpdateReply(lwm2m_context_t * contextP,
LOG_ARG_DBG("%d Registration update failed", dataP->server->shortID);
}
}
if (packet != NULL && packet->code != COAP_231_CONTINUE)
if (packet != NULL && packet->code == COAP_231_CONTINUE)
{
lwm2m_free(dataP->payload);
transaction_free_userData(contextP, transacP);
; // pass
}
else
{
uint8_t * payload = dataP->payload;
if (transaction_free_userData(contextP, transacP))
{
lwm2m_free(payload);
}
}
}

Expand Down

0 comments on commit 7fe7b0c

Please sign in to comment.