Skip to content

Commit b57d4cc

Browse files
jukkarkartben
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]> (cherry picked from commit 2f1a134)
1 parent 537361e commit b57d4cc

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
@@ -392,6 +392,7 @@ int net_send_data(struct net_pkt *pkt)
392392
* we just silently drop the packet by returning 0.
393393
*/
394394
if (status == -ENOMSG) {
395+
net_pkt_unref(pkt);
395396
ret = 0;
396397
goto err;
397398
}

0 commit comments

Comments
 (0)