From: Pawel Wodkowski Date: Wed, 25 Feb 2015 12:41:25 +0000 (+0100) Subject: ring: fix memory leak X-Git-Tag: spdx-start~9499 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=460a16507515654aac26165d2e755ddd46ebe99d;p=dpdk.git ring: fix memory leak Free kvlist on function exit to avoid memory leak during devinit. Signed-off-by: Pawel Wodkowski Acked-by: Olivier Matz --- diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c index 83ecfa851e..1e66d4ec19 100644 --- a/lib/librte_pmd_ring/rte_eth_ring.c +++ b/lib/librte_pmd_ring/rte_eth_ring.c @@ -527,7 +527,7 @@ out: static int rte_pmd_ring_devinit(const char *name, const char *params) { - struct rte_kvargs *kvlist; + struct rte_kvargs *kvlist = NULL; int ret = 0; struct node_action_list *info = NULL; @@ -548,7 +548,7 @@ rte_pmd_ring_devinit(const char *name, const char *params) info = rte_zmalloc("struct node_action_list", sizeof(struct node_action_list) + (sizeof(struct node_action_pair) * ret), 0); if (!info) - goto out; + goto out_free; info->total = ret; info->list = (struct node_action_pair*)(info + 1); @@ -567,8 +567,8 @@ rte_pmd_ring_devinit(const char *name, const char *params) } out_free: + rte_kvargs_free(kvlist); rte_free(info); -out: return ret; }