From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from compass.polito.it (compass.polito.it [130.192.55.110]) by dpdk.org (Postfix) with ESMTP id C0C5E8DAC for ; Fri, 20 Nov 2015 19:22:53 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by compass.polito.it (Postfix) with ESMTP id 8B76F1000EE for ; Fri, 20 Nov 2015 19:22:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= studenti.polito.it; h=content-type:content-type:cc:to:from:from :subject:subject:message-id:date:date:references:in-reply-to :received:mime-version:received:received:received; s=y2k10; t= 1448043772; bh=0HHEYZ8sAavtWV63c6jU8LUybcdp7EDYC78ZTVupO3Y=; b=c Oz/3tCpx1sFn/5dpJRpdzIWEQkDcXdefhAFPw/e1c4IiuhXENAEkX7gve6Ngh99y 5nCGfS9OjtXCzkK1Hw0HdEwVJYbxskha7w++g7vaztw+lkjx0M92i/Q8rtjh02fC GrUjiPb/Sc2MhOAQ/WxLXrgMxuiWCcHS2lfxscyDcM= X-Virus-Scanned: amavisd-new at studenti.polito.it Received: from compass.polito.it ([127.0.0.1]) by localhost (compass.polito.it [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id gXhy6PcJpkSx for ; Fri, 20 Nov 2015 19:22:52 +0100 (CET) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com [209.85.215.54]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: s203403@studenti.polito.it) by compass.polito.it (Postfix) with ESMTPSA id 423901000DA for ; Fri, 20 Nov 2015 19:22:52 +0100 (CET) Received: by lfdo63 with SMTP id o63so74340637lfd.2 for ; Fri, 20 Nov 2015 10:22:51 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.25.149.9 with SMTP id x9mr6554663lfd.53.1448043771717; Fri, 20 Nov 2015 10:22:51 -0800 (PST) Received: by 10.25.77.205 with HTTP; Fri, 20 Nov 2015 10:22:51 -0800 (PST) In-Reply-To: <59AF69C657FD0841A61C55336867B5B0359866FE@IRSMSX103.ger.corp.intel.com> References: <1447885757-13038-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it> <59AF69C657FD0841A61C55336867B5B0359866FE@IRSMSX103.ger.corp.intel.com> Date: Fri, 20 Nov 2015 19:22:51 +0100 X-Gmail-Original-Message-ID: Message-ID: From: =?UTF-8?Q?Mauricio_V=C3=A1squez?= To: "Richardson, Bruce" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] ring: Fix memory leakage in rte_pmd_ring_devuninit() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Nov 2015 18:22:54 -0000 On 20 November 2015 at 13:42, Richardson, Bruce wrote: > > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Mcnamara, John > > Sent: Friday, November 20, 2015 12:32 PM > > To: Mauricio Vasquez B ; > > dev@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] ring: Fix memory leakage in > > rte_pmd_ring_devuninit() > > > > > > > > > -----Original Message----- > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Mauricio Vasquez > > > B > > > Sent: Wednesday, November 18, 2015 10:29 PM > > > To: dev@dpdk.org > > > Subject: [dpdk-dev] [PATCH] ring: Fix memory leakage in > > > rte_pmd_ring_devuninit() > > > > > > When freeing the device, it is also necessary to free rx_queues and > > > tx_queues > > > > > > Signed-off-by: Mauricio Vasquez B > > > > > > --- > > > drivers/net/ring/rte_eth_ring.c | 3 +++ > > > 1 file changed, 3 insertions(+) > > > > > > diff --git a/drivers/net/ring/rte_eth_ring.c > > > b/drivers/net/ring/rte_eth_ring.c index 9a31bce..e091e4f 100644 > > > --- a/drivers/net/ring/rte_eth_ring.c > > > +++ b/drivers/net/ring/rte_eth_ring.c > > > @@ -582,6 +582,9 @@ rte_pmd_ring_devuninit(const char *name) > > > return -ENODEV; > > > > > > eth_dev_stop(eth_dev); > > > + > > > + rte_free(eth_dev->data->rx_queues); > > > + rte_free(eth_dev->data->tx_queues); > > > rte_free(eth_dev->data->dev_private); > > > rte_free(eth_dev->data); > > > > Hi, > > > > This should test for eth_dev->data before freeing the members. Like: > > > > if (eth_dev->data) { > > rte_free(eth_dev->data->rx_queues); > > rte_free(eth_dev->data->tx_queues); > > rte_free(eth_dev->data->dev_private); > > } > > > > Thanks, > > > > John > > That was my thought initially too, but since this is an uninit routine, > the data field must already have been set up correctly by the init/creation > function. > That was my reasoning too. > That being said, the check does no harm, so we might as well add it. > I agree, I will send a new patch version. > > /Bruce > Mauricio V,