From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas@monjalon.net>
Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com
 [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id ACE9F1BB12
 for <dev@dpdk.org>; Thu, 26 Oct 2017 23:56:22 +0200 (CEST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 1415F20D33;
 Thu, 26 Oct 2017 17:56:22 -0400 (EDT)
Received: from frontend1 ([10.202.2.160])
 by compute1.internal (MEProxy); Thu, 26 Oct 2017 17:56:22 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 cc:content-transfer-encoding:content-type:date:from:in-reply-to
 :message-id:mime-version:references:subject:to:x-me-sender
 :x-me-sender:x-sasl-enc; s=mesmtp; bh=8rntdSi9lICwKt7dsDX1IEogCs
 gRs3aEQ2hLYWUYt6Q=; b=WoPUHd9Cabx7MkhIOLXJyLdBilvDxSi8ag/WlXQlAG
 hqk3xdPK8boy5oBZKGgqcStP4v4IowVsHbwv+EYdtGt1BC5GXKLovYnjv6WGUyJc
 MwsUFpvNqfirVt6UUFe2QtI7IJwv2u1JwvM97jBkbau4nZ+20OY5QFOtwIl9xayA
 M=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:in-reply-to:message-id:mime-version:references
 :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=8rntdS
 i9lICwKt7dsDX1IEogCsgRs3aEQ2hLYWUYt6Q=; b=l8IJhBh+HL1xEfHwUuONAH
 NoxTzmDfKLNtkW/P1PKhJHQT5EepHfnVMKDKG/qEJmjmn3LL4q8MfvUI4bwe6rK0
 jHZEaKfQmD54WwPDtbnXSF/XBhUOE/P81kIFZpv5tXuJ/lxwF7SldLj3ZaVlutsw
 BVc8xiTo/OSWjSVyLKZMn4RERd+T/xTDLXO10wEoEGALc/emti+ubI+F2lwFHezu
 267SLB6hyt5ye26araGuCWoJgCAAqTNWQzuMNWU+t33r8PJJu1CbBYR53Re4msfl
 diTND/wKGnOkg3ppO5GeVxJEIJx1yQyRzdvGDz66z8hfO/ll1L3UUQ9EpGPClYkg
 ==
X-ME-Sender: <xms:BlryWWvDZcTKqQeGd9D1qoeZ5ZTP05i62fpLKVx0xFGDwv67K1E1Pg>
Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id BD1397E13B;
 Thu, 26 Oct 2017 17:56:21 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: Stefan Baranoff <sbaranoff@gmail.com>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>
Date: Thu, 26 Oct 2017 23:56:20 +0200
Message-ID: <1528417.6K8LKux9Ci@xps>
In-Reply-To: <CAHzKxpbykU5YfUbdkjt6s7N9a0d_4tpQJij0ek-yh-TNfVPqSA@mail.gmail.com>
References: <CAHzKxpb-d-naP+qJdG6DGa84z+DfcLSJkorH5K-j_+ebquOrDQ@mail.gmail.com>
 <CAHzKxpbykU5YfUbdkjt6s7N9a0d_4tpQJij0ek-yh-TNfVPqSA@mail.gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Subject: Re: [dpdk-dev] Fwd: Memory Leak: PCAP TX to File
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 26 Oct 2017 21:56:22 -0000

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 :)