From 64c03819ec2d697d64d8ea3c4e60b764a069cf60 Mon Sep 17 00:00:00 2001 From: Michael Scott Date: Thu, 13 Sep 2018 08:44:42 -0700 Subject: [PATCH] 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 --- subsys/net/lib/lwm2m/lwm2m_engine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index 2429e9a62c4..c7ac749af0c 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -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)) {