net: lwm2m: don't use pending pkt on retransmit error

We are using msg->cpkt.pkt as the net_pkt pointer in the call to
net_app_send_pkt().  Let's keep the code clean and not expose
ourselves to "out of order" issues, by also using msg->cpkt.pkt
in the error handling unref call.

Signed-off-by: Michael Scott <mike@foundries.io>
This commit is contained in:
Michael Scott 2018-09-13 08:44:42 -07:00 committed by Anas Nashif
commit 64c03819ec

View file

@ -3649,7 +3649,7 @@ static void retransmit_request(struct k_work *work)
if (r < 0) {
LOG_ERR("Error sending lwm2m message: %d", r);
/* don't error here, retry until timeout */
net_pkt_unref(pending->pkt);
net_pkt_unref(msg->cpkt.pkt);
}
if (!coap_pending_cycle(pending)) {