null: fix memory leak of kvargs
'struct rte_kvargs' is allocated in rte_kvargs_parse(), and should be freed with rte_kvargs_free(). Reported-by: John Mcnamara <john.mcnamara@intel.com> Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp> Acked-by: Neil Horman <nhorman@tuxdriver.com>
This commit is contained in:
parent
8eb680e452
commit
6e225d6a21
@ -506,7 +506,7 @@ rte_pmd_null_devinit(const char *name, const char *params)
|
||||
unsigned numa_node;
|
||||
unsigned packet_size = default_packet_size;
|
||||
unsigned packet_copy = default_packet_copy;
|
||||
struct rte_kvargs *kvlist;
|
||||
struct rte_kvargs *kvlist = NULL;
|
||||
int ret;
|
||||
|
||||
if (name == NULL)
|
||||
@ -527,7 +527,7 @@ rte_pmd_null_devinit(const char *name, const char *params)
|
||||
ETH_NULL_PACKET_SIZE_ARG,
|
||||
&get_packet_size_arg, &packet_size);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
goto free_kvlist;
|
||||
}
|
||||
|
||||
if (rte_kvargs_count(kvlist, ETH_NULL_PACKET_COPY_ARG) == 1) {
|
||||
@ -536,7 +536,7 @@ rte_pmd_null_devinit(const char *name, const char *params)
|
||||
ETH_NULL_PACKET_COPY_ARG,
|
||||
&get_packet_copy_arg, &packet_copy);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
goto free_kvlist;
|
||||
}
|
||||
}
|
||||
|
||||
@ -544,7 +544,12 @@ rte_pmd_null_devinit(const char *name, const char *params)
|
||||
"packet copy is %s\n", packet_size,
|
||||
packet_copy ? "enabled" : "disabled");
|
||||
|
||||
return eth_dev_null_create(name, numa_node, packet_size, packet_copy);
|
||||
ret = eth_dev_null_create(name, numa_node, packet_size, packet_copy);
|
||||
|
||||
free_kvlist:
|
||||
if (kvlist)
|
||||
rte_kvargs_free(kvlist);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
x
Reference in New Issue
Block a user