From: Pablo de Lara Date: Mon, 18 Jul 2016 13:21:04 +0000 (+0100) Subject: cryptodev: fix memory leak in parameter parsing X-Git-Tag: spdx-start~6110 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5a4e71f1f461a93b34fae5249f8131f1039bb3bc;p=dpdk.git 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 --- 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;