net: lwm2m: fix packet leak in timeout work
When a packet expires after the pending retries we call lwm2m_release_message() to free up resources. This includes cleanup of the pending structure which calls net_pkt_unref on the pending packet. This would normally free up the packet memory. However, earlier in the pending processing we add a ref to the packet so that normal send processing doesn't free up the memory. This meant we were leaking packet memory every time we had an expiration due to timeout. Let's do an unref prior to calling lwm2m_release_message() to make sure the packet memory is freed correctly. Signed-off-by: Michael Scott <michael.scott@linaro.org>
This commit is contained in:
parent
c9a80de76b
commit
0b0fd5515d
1 changed files with 2 additions and 0 deletions
|
@ -2725,6 +2725,8 @@ static void retransmit_request(struct k_work *work)
|
|||
msg->message_timeout_cb(msg);
|
||||
}
|
||||
|
||||
/* final unref to release pkt */
|
||||
net_pkt_unref(pending->pkt);
|
||||
lwm2m_release_message(msg);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue