From 19f8167c68ce9feff02db23365fdf42bd1a29741 Mon Sep 17 00:00:00 2001 From: Dror Birkman Date: Tue, 20 Sep 2016 15:08:56 +0300 Subject: [PATCH] net/pcap: fix memory leak in jumbo frames If rte_pktmbuf_alloc() fails on any segment that is not the initial segment, previously allocated mbufs are not freed. Fixes: 6db141c91e1f ("pcap: support jumbo frames") Signed-off-by: Dror Birkman Acked-by: Ferruh Yigit --- drivers/net/pcap/rte_eth_pcap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 48d96fae50..51ef86f7af 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -222,8 +222,10 @@ eth_pcap_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) if (unlikely(eth_pcap_rx_jumbo(pcap_q->mb_pool, mbuf, packet, - header.caplen) == -1)) + header.caplen) == -1)) { + rte_pktmbuf_free(mbuf); break; + } } mbuf->pkt_len = (uint16_t)header.caplen; -- 2.20.1