net/virtio: fix memory leak on failure
In function eth_virtio_dev_init(), dynamic memory stored
in "eth_dev->data->mac_addrs" variable and it is not freed
when function return,
this is a possible memory leak.
Fixes: 8ced1542f7
("net/virtio: eth_dev->data->mac_addrs is not freed")
Cc: stable@dpdk.org
Signed-off-by: Pengzhen Liu <liupengzhen3@huawei.com>
Acked-by: Yuanhan Liu <yliu@fridaylinux.org>
This commit is contained in:
parent
9bc2cbb007
commit
43d18765c0
@ -1620,13 +1620,13 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
|
||||
if (!hw->virtio_user_dev) {
|
||||
ret = vtpci_init(RTE_ETH_DEV_TO_PCI(eth_dev), hw);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* reset device and negotiate default features */
|
||||
ret = virtio_init_device(eth_dev, VIRTIO_PMD_DEFAULT_GUEST_FEATURES);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
goto out;
|
||||
|
||||
/* Setup interrupt callback */
|
||||
if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
|
||||
@ -1634,6 +1634,10 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
|
||||
virtio_interrupt_handler, eth_dev);
|
||||
|
||||
return 0;
|
||||
|
||||
out:
|
||||
rte_free(eth_dev->data->mac_addrs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user