Skip to content

Commit b28984f

Browse files
hechaoyongferruhy
authored andcommitted
net/nfp: fix memory leak in VF initialization logic
Fix one memory leak problem in the logic of VF initialization. Fixes: d81e2b5 ("net/nfp: move device info into process private data") Cc: [email protected] Signed-off-by: Chaoyong He <[email protected]> Reviewed-by: Long Wu <[email protected]> Reviewed-by: Peng Zhang <[email protected]> Acked-by: Stephen Hemminger <[email protected]>
1 parent fef93b2 commit b28984f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/net/nfp/nfp_ethdev_vf.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,13 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)
322322
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
323323
return 0;
324324

325-
net_hw->eth_xstats_base = rte_malloc("rte_eth_xstat",
326-
sizeof(struct rte_eth_xstat) * nfp_net_xstats_size(eth_dev), 0);
325+
net_hw->eth_xstats_base = rte_calloc("rte_eth_xstat",
326+
nfp_net_xstats_size(eth_dev), sizeof(struct rte_eth_xstat), 0);
327327
if (net_hw->eth_xstats_base == NULL) {
328328
PMD_INIT_LOG(ERR, "No memory for xstats base values on device %s!",
329329
pci_dev->device.name);
330-
return -ENOMEM;
330+
err = -ENOMEM;
331+
goto hw_priv_free;
331332
}
332333

333334
/* Work out where in the BAR the queues start. */

0 commit comments

Comments
 (0)