[dpdk-dev] [PATCH] ring: fix minor memory leak of kvlist in dev init

Wodkowski, PawelX pawelx.wodkowski at intel.com
Mon Feb 23 14:27:42 CET 2015



> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of John McNamara
> Sent: Monday, February 23, 2015 2:17 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH] ring: fix minor memory leak of kvlist in dev init
> 
> Fix for Klockwork identified issue.
> 
> Signed-off-by: John McNamara <john.mcnamara at intel.com>
> ---
>  lib/librte_pmd_ring/rte_eth_ring.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/librte_pmd_ring/rte_eth_ring.c
> b/lib/librte_pmd_ring/rte_eth_ring.c
> index a23e933..88a1382 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;
> 
> @@ -569,6 +569,7 @@ rte_pmd_ring_devinit(const char *name, const char
> *params)
>  out_free:
>  	rte_free(info);
>  out:
> +	rte_kvargs_free(kvlist);
>  	return ret;
>  }
> 
> --
> 1.7.4.1

This is wrong/incomplete as rte_kvargs_free() is unable to handle NULL argument.
I have patch under review that fix this issue along with rte_kvargs_free().

Pawel




More information about the dev mailing list