net/mlx5: fix resource leak in case of error

If something went wrong in mlx5_pci_prob the allocated eth dev
will cause a memory leak.

This commit release the eth dev that was previously allocated.

Fixes: 771fa900b7 ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters")
Cc: stable@dpdk.org

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
This commit is contained in:
Raslan Darawsheh 2018-05-08 12:11:27 +03:00 committed by Ferruh Yigit
parent e9f4166014
commit 690de2850b

View File

@ -1063,6 +1063,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
claim_zero(mlx5_glue->dealloc_pd(pd));
if (ctx)
claim_zero(mlx5_glue->close_device(ctx));
if (eth_dev && rte_eal_process_type() == RTE_PROC_PRIMARY)
rte_eth_dev_release_port(eth_dev);
break;
}
/*