DPDK patches and discussions
 help / color / mirror / Atom feed
From: John McNamara <john.mcnamara@intel.com>
To: dev@dpdk.org
Cc: linville@redhat.com
Subject: [dpdk-dev] [PATCH] af_packet: fix minor memory leak of kvlist in dev init
Date: Mon, 23 Feb 2015 13:29:16 +0000
Message-ID: <1424698156-15793-1-git-send-email-john.mcnamara@intel.com> (raw)

Fix for Klockwork identified issue.

Signed-off-by: John McNamara <john.mcnamara@intel.com>
---
 lib/librte_pmd_af_packet/rte_eth_af_packet.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/librte_pmd_af_packet/rte_eth_af_packet.c b/lib/librte_pmd_af_packet/rte_eth_af_packet.c
index 1ffe1cd..7ee3b31 100644
--- a/lib/librte_pmd_af_packet/rte_eth_af_packet.c
+++ b/lib/librte_pmd_af_packet/rte_eth_af_packet.c
@@ -803,7 +803,7 @@ rte_pmd_af_packet_devinit(const char *name, const char *params)
 {
 	unsigned numa_node;
 	int ret;
-	struct rte_kvargs *kvlist;
+	struct rte_kvargs *kvlist = NULL;
 	int sockfd = -1;
 
 	RTE_LOG(INFO, PMD, "Initializing pmd_af_packet for %s\n", name);
@@ -823,16 +823,21 @@ rte_pmd_af_packet_devinit(const char *name, const char *params)
 		ret = rte_kvargs_process(kvlist, ETH_AF_PACKET_IFACE_ARG,
 		                         &open_packet_iface, &sockfd);
 		if (ret < 0)
-			return -1;
+			goto out;
 	}
 
 	ret = rte_eth_from_packet(name, &sockfd, numa_node, kvlist);
 	close(sockfd); /* no longer needed */
 
 	if (ret < 0)
-		return -1;
+		goto out;
 
+	rte_kvargs_free(kvlist);
 	return 0;
+
+out:
+	rte_kvargs_free(kvlist);
+	return -1;
 }
 
 static struct rte_driver pmd_af_packet_drv = {
-- 
1.7.4.1

             reply	other threads:[~2015-02-23 13:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-23 13:29 John McNamara [this message]
2015-03-06 13:38 ` Mcnamara, John

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=1424698156-15793-1-git-send-email-john.mcnamara@intel.com \
    --to=john.mcnamara@intel.com \
    --cc=dev@dpdk.org \
    --cc=linville@redhat.com \
    /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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git