[dpdk-dev] [PATCH] ethdev: fix memory leak on removing eth rxtx callback

wanlebing wanlebing at gmail.com
Wed Nov 21 14:11:27 CET 2018


eth rxtx callback is dynamically allocated using rte_zmalloc()
but not released. Fix it by calling rte_free() to free callback
when removing rxtx callback.

Signed-off-by: wanlebing <wanlebing at didichuxing.com>
Signed-off-by: wanlebing <wanlebing at gmail.com>
---
 lib/librte_ethdev/rte_ethdev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 5f858174b..f00311047 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -3926,6 +3926,7 @@ rte_eth_remove_rx_callback(uint16_t port_id, uint16_t queue_id,
 		if (cb == user_cb) {
 			/* Remove the user cb from the callback list. */
 			*prev_cb = cb->next;
+			rte_free(cb);
 			ret = 0;
 			break;
 		}
@@ -3960,6 +3961,7 @@ rte_eth_remove_tx_callback(uint16_t port_id, uint16_t queue_id,
 		if (cb == user_cb) {
 			/* Remove the user cb from the callback list. */
 			*prev_cb = cb->next;
+			rte_free(cb);
 			ret = 0;
 			break;
 		}
-- 
2.14.1



More information about the dev mailing list