DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] af_packet: fix minor memory leak of kvlist in dev init
@ 2015-02-23 13:29 John McNamara
  2015-03-06 13:38 ` Mcnamara, John
  0 siblings, 1 reply; 2+ messages in thread
From: John McNamara @ 2015-02-23 13:29 UTC (permalink / raw)
  To: dev; +Cc: linville

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-06 13:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-23 13:29 [dpdk-dev] [PATCH] af_packet: fix minor memory leak of kvlist in dev init John McNamara
2015-03-06 13:38 ` Mcnamara, John

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