Skip to content

Commit 2f1a134

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 <jukka.rissanen@nordicsemi.no>
1 parent dcbd0d1 commit 2f1a134

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
@@ -393,6 +393,7 @@ int net_try_send_data(struct net_pkt *pkt, k_timeout_t timeout)
393393
* we just silently drop the packet by returning 0.
394394
*/
395395
if (status == -ENOMSG) {
396+
net_pkt_unref(pkt);
396397
ret = 0;
397398
goto err;
398399
}

0 commit comments

Comments
 (0)