From: Jia Yu Date: Mon, 23 Mar 2015 21:53:56 +0000 (-0700) Subject: bond: remove memory allocation for PCI driver X-Git-Tag: spdx-start~9380 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=10ef5d7891882d8b5a379904b40c2ba66ee1472a;p=dpdk.git bond: remove memory allocation for PCI driver eth_driver already contains rte_pci_driver data structure. Allocating rte_pci_driver without referencing it after bond creation causes memory leakage. Signed-off-by: Jia Yu Acked-by: Declan Doherty --- diff --git a/lib/librte_pmd_bond/rte_eth_bond_api.c b/lib/librte_pmd_bond/rte_eth_bond_api.c index 903b7c395e..13f39417ea 100644 --- a/lib/librte_pmd_bond/rte_eth_bond_api.c +++ b/lib/librte_pmd_bond/rte_eth_bond_api.c @@ -230,11 +230,8 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id) goto err; } - pci_drv = rte_zmalloc_socket(name, sizeof(*pci_drv), 0, socket_id); - if (pci_drv == NULL) { - RTE_BOND_LOG(ERR, "Unable to malloc pci_drv on socket"); - goto err; - } + pci_drv = ð_drv->pci_drv; + pci_id_table = rte_zmalloc_socket(name, sizeof(*pci_id_table), 0, socket_id); if (pci_id_table == NULL) { RTE_BOND_LOG(ERR, "Unable to malloc pci_id_table on socket"); @@ -266,9 +263,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id) pci_dev->numa_node = socket_id; pci_drv->name = driver_name; - eth_drv->pci_drv = (struct rte_pci_driver)(*pci_drv); eth_dev->driver = eth_drv; - eth_dev->data->dev_private = internals; eth_dev->data->nb_rx_queues = (uint16_t)1; eth_dev->data->nb_tx_queues = (uint16_t)1; @@ -325,8 +320,6 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id) err: if (pci_dev) rte_free(pci_dev); - if (pci_drv) - rte_free(pci_drv); if (pci_id_table) rte_free(pci_id_table); if (eth_drv)