From 2d27abc165bc5eacd908048bb4c1170354f8353e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 18 Mar 2025 16:05:26 +0200 Subject: [PATCH] net: core: Free packet properly if TTL/hop limit is 0 We drop the packet if TTL or hop limit is 0, but we should also unref the packet in this case because we return 0 to the caller which is not then able to free the packet because it thinks that the packet was sent properly. Signed-off-by: Jukka Rissanen --- subsys/net/ip/net_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/net/ip/net_core.c b/subsys/net/ip/net_core.c index 6f05ea7e5f2ed..5986186abdfd3 100644 --- a/subsys/net/ip/net_core.c +++ b/subsys/net/ip/net_core.c @@ -398,6 +398,7 @@ int net_send_data(struct net_pkt *pkt) * we just silently drop the packet by returning 0. */ if (status == -ENOMSG) { + net_pkt_unref(pkt); return 0; }