DPDK patches and discussions
 help / color / mirror / Atom feed
From: John McNamara <john.mcnamara@intel.com>
To: bruce.richardson@intel.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2] ring: fix minor memory free issue
Date: Fri,  6 Nov 2015 17:40:39 +0000	[thread overview]
Message-ID: <1446831639-9576-1-git-send-email-john.mcnamara@intel.com> (raw)
In-Reply-To: <1446830917-7376-1-git-send-email-john.mcnamara@intel.com>

Fix minor memory free issue in error clean-up.

Fixes: 651c505af862 ("ring: enhance device setup from rings")
Reported-by Coverity (CID 119258)

Signed-off-by: John McNamara <john.mcnamara@intel.com>
---

V2:
* Add fixline.

 drivers/net/ring/rte_eth_ring.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index cc60008..b91a643 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -363,9 +363,11 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
 	return data->port_id;
 
 error:
-	rte_free(data->rx_queues);
-	rte_free(data->tx_queues);
-	rte_free(data);
+	if (data) {
+		rte_free(data->rx_queues);
+		rte_free(data->tx_queues);
+		rte_free(data);
+	}
 	rte_free(internals);
 
 	return -1;
-- 
1.8.1.4

  reply	other threads:[~2015-11-06 17:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06 17:28 [dpdk-dev] [PATCH] " John McNamara
2015-11-06 17:40 ` John McNamara [this message]
2015-11-06 23:09 ` 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=1446831639-9576-1-git-send-email-john.mcnamara@intel.com \
    --to=john.mcnamara@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /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).