From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: Fwd: Memory Leak: PCAP TX to File Date: Thu, 26 Oct 2017 23:56:20 +0200 Message-ID: <1528417.6K8LKux9Ci@xps> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, Ferruh Yigit To: Stefan Baranoff Return-path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id ACE9F1BB12 for ; Thu, 26 Oct 2017 23:56:22 +0200 (CEST) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Cc Ferruh, maintainer of this driver. 26/10/2017 19:44, Stefan Baranoff: > All, > > I think I've found a (very minor) memory leak in writing to a PCAP file. In > drivers/net/pcap/rte_eth_pcap.c in open_single_tx_pcap around line 405 a > pcap_t is allocated by pcap_open_dead but is never freed. > > I see two obvious fixes: > 1) Free the pcap_t immediately after either on pcap_dump_open success or > failure > 2) Set the pcap_t pointer internals->tx_queue[i]->tx->pcap so when the > eth_dev_stop callback happens the pcap_t is freed. > > I believe the first is safe but am not a libpcap guru. Can someone please > confirm this? Do not hesitate to send a patch, even if you are not sure. You can annotate your patch to discuss your hesitations. We are a patch-driven community :)