DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] crypto: fix memory leak
@ 2016-07-18 12:00 Pablo de Lara
  2016-07-18 12:32 ` Pattan, Reshma
  2016-07-18 12:47 ` [dpdk-dev] [PATCH v2] " Pablo de Lara
  0 siblings, 2 replies; 8+ messages in thread
From: Pablo de Lara @ 2016-07-18 12:00 UTC (permalink / raw)
  To: dev; +Cc: declan.doherty, Pablo de Lara

When parsing the parameters for virtual device initialization,
rte_kvargs structure was being freed only if there was an error,
not when parsing was successful.

Coverity issue: 124568

Fixes: f3e764fa2fb7 ("cryptodev: uninline parameter parsing")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 lib/librte_cryptodev/rte_cryptodev.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 20e5beb..aaa9879 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -148,7 +148,7 @@ int
 rte_cryptodev_parse_vdev_init_params(struct rte_crypto_vdev_init_params *params,
 		const char *input_args)
 {
-	struct rte_kvargs *kvlist;
+	struct rte_kvargs *kvlist = NULL;
 	int ret;
 
 	if (params == NULL)
@@ -187,10 +187,11 @@ rte_cryptodev_parse_vdev_init_params(struct rte_crypto_vdev_init_params *params,
 		}
 	}
 
-	return 0;
+	ret = 0;
 
 free_kvlist:
-	rte_kvargs_free(kvlist);
+	if (kvlist != NULL)
+		rte_kvargs_free(kvlist);
 	return ret;
 }
 
-- 
2.7.4

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

end of thread, other threads:[~2016-07-22  9:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-18 12:00 [dpdk-dev] [PATCH] crypto: fix memory leak Pablo de Lara
2016-07-18 12:32 ` Pattan, Reshma
2016-07-18 12:42   ` De Lara Guarch, Pablo
2016-07-18 12:47 ` [dpdk-dev] [PATCH v2] " Pablo de Lara
2016-07-18 12:59   ` Pattan, Reshma
2016-07-18 13:00   ` Mcnamara, John
2016-07-18 13:21   ` [dpdk-dev] [PATCH v3] " Pablo de Lara
2016-07-22  9:02     ` 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).