From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH] ethdev: fix memory leak on removing eth rxtx callback Date: Wed, 21 Nov 2018 14:48:46 +0000 Message-ID: <219e09d4-5516-b297-3e85-d4078e55a2fd@intel.com> References: <20181121131127.28528-1-wanlebing@didichuxing.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: wanlebing To: wanlebing , dev@dpdk.org, Konstantin Ananyev Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id D3E326C9B for ; Wed, 21 Nov 2018 15:48:48 +0100 (CET) In-Reply-To: <20181121131127.28528-1-wanlebing@didichuxing.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 11/21/2018 1:11 PM, wanlebing wrote: > 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. I guess they are not freed intentionally because there is no safe way to do it. I remember Konstantin sent an RFC in the past to rework the callbacks, cc'ed him for more details. > > Signed-off-by: wanlebing > Signed-off-by: wanlebing > --- > 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; > } >