[dpdk-dev] ring: Fix memory leakage in rte_pmd_ring_devuninit

Message ID 1448043859-4326-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it (mailing list archive)
State Accepted, archived
Headers

Commit Message

Mauricio Vasquez B Nov. 20, 2015, 6:24 p.m. UTC
  When freeing the device it is also neccesary to free
rx_queues and tx_queues

Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>
---
v2:
Added extra control before freeing members of eth_dev->data

 drivers/net/ring/rte_eth_ring.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  

Comments

Thomas Monjalon Nov. 23, 2015, 10:47 p.m. UTC | #1
2015-11-20 19:24, Mauricio Vasquez B:
> When freeing the device it is also neccesary to free
> rx_queues and tx_queues
> 
> Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>

Applied with spacing fix, thanks
  

Patch

diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 9a31bce..4ce0256 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -582,7 +582,12 @@  rte_pmd_ring_devuninit(const char *name)
 		return -ENODEV;
 
 	eth_dev_stop(eth_dev);
-	rte_free(eth_dev->data->dev_private);
+
+	if(eth_dev->data) {
+		rte_free(eth_dev->data->rx_queues);
+		rte_free(eth_dev->data->tx_queues);
+		rte_free(eth_dev->data->dev_private);
+	}
 	rte_free(eth_dev->data);
 
 	rte_eth_dev_release_port(eth_dev);