Skip to content

Commit 5e5baa5

Browse files
jukkarnashif
authored andcommitted
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 <[email protected]>
1 parent 7dcd584 commit 5e5baa5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

subsys/net/ip/net_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ int net_send_data(struct net_pkt *pkt)
398398
* we just silently drop the packet by returning 0.
399399
*/
400400
if (status == -ENOMSG) {
401+
net_pkt_unref(pkt);
401402
return 0;
402403
}
403404

0 commit comments

Comments
 (0)