From: Ferruh Yigit Date: Fri, 28 Apr 2017 07:43:11 +0000 (+0100) Subject: net/ark: fix kvargs memory leak X-Git-Tag: spdx-start~3301 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0f31eb0cf248acd997b6e56fde63b1edeea9a425;p=dpdk.git net/ark: fix kvargs memory leak Coverity issue: 1428042 Fixes: 1131cbf0fb2b ("net/ark: stub PMD for Atomic Rules Arkville") Signed-off-by: Ferruh Yigit Acked-by: John Miller --- diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index 4caad98a84..83961f5099 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -922,6 +922,7 @@ eth_ark_check_args(struct ark_adapter *ark, const char *params) struct rte_kvargs *kvlist; unsigned int k_idx; struct rte_kvargs_pair *pair = NULL; + int ret = -1; kvlist = rte_kvargs_parse(params, valid_arguments); if (kvlist == NULL) @@ -942,7 +943,7 @@ eth_ark_check_args(struct ark_adapter *ark, const char *params) &process_pktdir_arg, ark) != 0) { PMD_DRV_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTDIR_ARG); - return -1; + goto free_kvlist; } if (rte_kvargs_process(kvlist, @@ -950,7 +951,7 @@ eth_ark_check_args(struct ark_adapter *ark, const char *params) &process_file_args, ark->pkt_gen_args) != 0) { PMD_DRV_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTGEN_ARG); - return -1; + goto free_kvlist; } if (rte_kvargs_process(kvlist, @@ -958,7 +959,7 @@ eth_ark_check_args(struct ark_adapter *ark, const char *params) &process_file_args, ark->pkt_chkr_args) != 0) { PMD_DRV_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTCHKR_ARG); - return -1; + goto free_kvlist; } PMD_DRV_LOG(INFO, "packet director set to 0x%x\n", ark->pkt_dir_v); @@ -980,7 +981,12 @@ eth_ark_check_args(struct ark_adapter *ark, const char *params) ark_pktchkr_setup(ark->pc); } - return 0; + ret = 0; + +free_kvlist: + rte_kvargs_free(kvlist); + + return ret; } RTE_PMD_REGISTER_PCI(net_ark, rte_ark_pmd);