Skip to contentSkip to conversation

ring: fix minor memory leak of kvlist in dev init

PATCH In review John McNamara 2 participants 3 messages Feb 23, 2015 – Feb 24, 2015 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ring: fix minor memory leak of kvlist in dev init

Fix for Klockwork identified issue.

---
 lib/librte_pmd_ring/rte_eth_ring.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
lib/librte_pmd_ring/rte_eth_ring.c +2 -1
index a23e933..88a1382 100644
@@ -527,7 +527,7 @@ out:
 static int
 rte_pmd_ring_devinit(const char *name, const char *params)
 {
-	struct rte_kvargs *kvlist;
+	struct rte_kvargs *kvlist = NULL;
 	int ret = 0;
 	struct node_action_list *info = NULL;
 
@@ -569,6 +569,7 @@ rte_pmd_ring_devinit(const char *name, const char *params)
 out_free:
 	rte_free(info);
 out:
+	rte_kvargs_free(kvlist);
 	return ret;
 }
 
Signature · 1 line
1.7.4.1
#2 lore raw
In reply to a message not in the archive
Quoted 39 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of John McNamara
Sent: Monday, February 23, 2015 2:17 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH] ring: fix minor memory leak of kvlist in dev init

Fix for Klockwork identified issue.

---
 lib/librte_pmd_ring/rte_eth_ring.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
lib/librte_pmd_ring/rte_eth_ring.c +2 -2
index a23e933..88a1382 100644
@@ -527,7 +527,7 @@ out:
 static int
 rte_pmd_ring_devinit(const char *name, const char *params)
 {
-	struct rte_kvargs *kvlist;
+	struct rte_kvargs *kvlist = NULL;
 	int ret = 0;
 	struct node_action_list *info = NULL;
 
@@ -569,6 +569,7 @@ rte_pmd_ring_devinit(const char *name, const char
 *params)
 out_free:
 	rte_free(info);
 out:
+	rte_kvargs_free(kvlist);
 	return ret;
 }
 
--
Quoted 1 line

1.7.4.1

This is wrong/incomplete as rte_kvargs_free() is unable to handle NULL argument. I have patch under review that fix this issue along with rte_kvargs_free().

Pawel