Fix one memory leak problem in the logic of VF initialization. Fixes: d81e2b514dc9 ("net/nfp: move device info into process private data") Cc: sta...@dpdk.org
Signed-off-by: Chaoyong He <chaoyong...@corigine.com> Reviewed-by: Long Wu <long...@corigine.com> Reviewed-by: Peng Zhang <peng.zh...@corigine.com> Acked-by: Stephen Hemminger <step...@networkplumber.org> --- drivers/net/nfp/nfp_ethdev_vf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index ab413a2c5a..0aadca9010 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -322,12 +322,13 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; - net_hw->eth_xstats_base = rte_malloc("rte_eth_xstat", - sizeof(struct rte_eth_xstat) * nfp_net_xstats_size(eth_dev), 0); + net_hw->eth_xstats_base = rte_calloc("rte_eth_xstat", + nfp_net_xstats_size(eth_dev), sizeof(struct rte_eth_xstat), 0); if (net_hw->eth_xstats_base == NULL) { PMD_INIT_LOG(ERR, "No memory for xstats base values on device %s!", pci_dev->device.name); - return -ENOMEM; + err = -ENOMEM; + goto hw_priv_free; } /* Work out where in the BAR the queues start. */ -- 2.39.1