DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] af_packet: Fix some klocwork errors
@ 2015-02-26  6:42 Ouyang Changchun
  2015-02-26  8:44 ` Pawel Wodkowski
  2015-02-27  0:49 ` [dpdk-dev] [PATCH v2] " Ouyang Changchun
  0 siblings, 2 replies; 22+ messages in thread
From: Ouyang Changchun @ 2015-02-26  6:42 UTC (permalink / raw)
  To: dev

Fix possible memory leak issue: free kvlist before return;
Fix possible resource lost issue: close qssockfd before return;

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
 lib/librte_pmd_af_packet/rte_eth_af_packet.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 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 80e9bdf..cf8f4fa 100644
--- a/lib/librte_pmd_af_packet/rte_eth_af_packet.c
+++ b/lib/librte_pmd_af_packet/rte_eth_af_packet.c
@@ -694,6 +694,8 @@ error:
 		}
 		rte_free(*internals);
 	}
+	if (qsockfd != -1)
+		close(qsockfd);
 	return -1;
 }
 
@@ -822,16 +824,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)
+		if (ret < 0) {
+			rte_kvargs_free(kvlist);
 			return -1;
+		}
 	}
 
 	ret = rte_eth_from_packet(name, &sockfd, numa_node, kvlist);
 	close(sockfd); /* no longer needed */
 
-	if (ret < 0)
+	if (ret < 0) {
+		rte_kvargs_free(kvlist);
 		return -1;
+	}
 
+	rte_kvargs_free(kvlist);
 	return 0;
 }
 
-- 
1.8.4.2

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

end of thread, other threads:[~2015-03-17 21:35 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-26  6:42 [dpdk-dev] [PATCH] af_packet: Fix some klocwork errors Ouyang Changchun
2015-02-26  8:44 ` Pawel Wodkowski
2015-02-27  0:49 ` [dpdk-dev] [PATCH v2] " Ouyang Changchun
2015-02-27 14:04   ` Neil Horman
2015-02-28  0:51     ` Ouyang, Changchun
2015-02-28  1:27   ` [dpdk-dev] [PATCH v3] " Ouyang Changchun
2015-03-09  3:49     ` [dpdk-dev] [PATCH v4] " Ouyang Changchun
2015-03-09  6:38       ` Qiu, Michael
2015-03-09  8:47         ` Ouyang, Changchun
2015-03-09  8:58       ` [dpdk-dev] [PATCH v5] " Ouyang Changchun
2015-03-09 19:25         ` John W. Linville
2015-03-10  3:29         ` [dpdk-dev] [PATCH v6] " Ouyang Changchun
2015-03-10  8:36           ` Pawel Wodkowski
2015-03-10  8:49             ` Ouyang, Changchun
2015-03-10  8:59               ` Pawel Wodkowski
2015-03-10 10:19               ` Thomas Monjalon
2015-03-11  1:18                 ` Ouyang, Changchun
2015-03-11  1:34           ` [dpdk-dev] [PATCH v7] " Ouyang Changchun
2015-03-12 10:43             ` Qiu, Michael
2015-03-12 13:38               ` Neil Horman
2015-03-12 17:09                 ` John W. Linville
2015-03-17 21:34                   ` Thomas Monjalon

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