From 5a4e71f1f461a93b34fae5249f8131f1039bb3bc Mon Sep 17 00:00:00 2001 From: Pablo de Lara Date: Mon, 18 Jul 2016 14:21:04 +0100 Subject: [PATCH] cryptodev: fix memory leak in parameter parsing 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 Acked-by: Reshma Pattan --- lib/librte_cryptodev/rte_cryptodev.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index 20e5beb8bb..fc4123b63e 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -148,8 +148,8 @@ int rte_cryptodev_parse_vdev_init_params(struct rte_crypto_vdev_init_params *params, const char *input_args) { - struct rte_kvargs *kvlist; - int ret; + struct rte_kvargs *kvlist = NULL; + int ret = 0; if (params == NULL) return -EINVAL; @@ -187,8 +187,6 @@ rte_cryptodev_parse_vdev_init_params(struct rte_crypto_vdev_init_params *params, } } - return 0; - free_kvlist: rte_kvargs_free(kvlist); return ret; -- 2.20.1