From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dror Birkman Subject: [PATCH] pcap: fix memory leak in jumbo frames Date: Tue, 20 Sep 2016 13:39:23 +0300 Message-ID: <1474367963-83879-1-git-send-email-dror.birkman@lightcyber.com> Cc: dev@dpdk.org, Dror Birkman To: nicolas.pernas.maradei@emutex.com, ferruh.yigit@intel.com Return-path: Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id EDC23590E for ; Tue, 20 Sep 2016 12:39:39 +0200 (CEST) Received: by mail-wm0-f48.google.com with SMTP id l132so201063302wmf.0 for ; Tue, 20 Sep 2016 03:39:39 -0700 (PDT) List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" If rte_pktmbuf_alloc() fails on any segment that is not the initial segment, previously allocated mbufs are not freed. Signed-off-by: Dror Birkman --- 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 b7a3b03..db19a66 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -229,8 +229,10 @@ eth_pcap_rx(void *queue, 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.3.0