DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Mcnamara, John" <john.mcnamara@intel.com>
To: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] ring: Fix memory leakage in	rte_pmd_ring_devuninit()
Date: Fri, 20 Nov 2015 12:32:21 +0000	[thread overview]
Message-ID: <B27915DBBA3421428155699D51E4CFE2023C0894@IRSMSX103.ger.corp.intel.com> (raw)
In-Reply-To: <1447885757-13038-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it>



> -----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
> <mauricio.vasquezbernal@studenti.polito.it>
> ---
>  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

  parent reply	other threads:[~2015-11-20 12:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-18 22:29 Mauricio Vasquez B
2015-11-20 12:20 ` Iremonger, Bernard
2015-11-20 12:32 ` Mcnamara, John [this message]
2015-11-20 12:42   ` Richardson, Bruce
2015-11-20 18:22     ` Mauricio Vásquez
2015-11-20 18:24 ` [dpdk-dev] [PATCH] ring: Fix memory leakage in rte_pmd_ring_devuninit Mauricio Vasquez B
2015-11-23 22:47   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B27915DBBA3421428155699D51E4CFE2023C0894@IRSMSX103.ger.corp.intel.com \
    --to=john.mcnamara@intel.com \
    --cc=dev@dpdk.org \
    --cc=mauricio.vasquezbernal@studenti.polito.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).