graph: fix null dereference in stats
In function 'stats_mem_init', pointer 'stats' should
be confirmed not null before memset it.
Fixes: af1ae8b6a3
("graph: implement stats")
Cc: stable@dpdk.org
Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
This commit is contained in:
parent
3b47572fbe
commit
2d2bf7de1a
@ -119,8 +119,8 @@ stats_mem_init(struct cluster *cluster,
|
||||
cluster_node_size = RTE_ALIGN(cluster_node_size, RTE_CACHE_LINE_SIZE);
|
||||
|
||||
stats = realloc(NULL, sz);
|
||||
memset(stats, 0, sz);
|
||||
if (stats) {
|
||||
memset(stats, 0, sz);
|
||||
stats->fn = fn;
|
||||
stats->cluster_node_size = cluster_node_size;
|
||||
stats->max_nodes = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user