Skip to content

Commit 220c4ff

Browse files
raitraak-rrkkartben
authored andcommitted
net: ethernet: arp: Fix incorrect adding to the pending queue
k_fifo_put is a macro that expands the call to net_pkt_ref(pending) multiple times when CONFIG_TRACING is enabled thus causing extra reference for the pending packet and a memory leak. Fix by moving the referencing call to a separate line. Signed-off-by: Rait Rääk <raitraak@gmail.com>
1 parent c498818 commit 220c4ff

File tree

1 file changed

+2
-1
lines changed
  • subsys/net/l2/ethernet

1 file changed

+2
-1
lines changed

subsys/net/l2/ethernet/arp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ static inline struct net_pkt *arp_prepare(struct net_if *iface,
291291
*/
292292
if (entry) {
293293
if (!net_pkt_ipv4_acd(pkt)) {
294-
k_fifo_put(&entry->pending_queue, net_pkt_ref(pending));
294+
net_pkt_ref(pending);
295+
k_fifo_put(&entry->pending_queue, pending);
295296
}
296297

297298
entry->iface = net_pkt_iface(pkt);

0 commit comments

Comments
 (0)