[dpdk-dev] [PATCH v2] eal: fix memory leak when removing event_cb

Jeff Guo jia.guo at intel.com
Thu Jul 2 11:28:14 CEST 2020


hi, yunjian

On 6/30/2020 7:56 PM, wangyunjian wrote:

> From: Yunjian Wang <wangyunjian at huawei.com>
>
> The event_cb->dev_name is not freed when freeing event_cb,
> and this causes a memory leak.
>
> Fixes: a753e53d517b ("eal: add device event monitor framework")
> Cc: stable at dpdk.org
>
> Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
> ---
>   lib/librte_eal/common/eal_common_dev.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
> index 9e4f09d..4cfdb80 100644
> --- a/lib/librte_eal/common/eal_common_dev.c
> +++ b/lib/librte_eal/common/eal_common_dev.c
> @@ -526,6 +526,8 @@ static int cmp_dev_name(const struct rte_device *dev, const void *_name)
>   		 */
>   		if (event_cb->active == 0) {
>   			TAILQ_REMOVE(&dev_event_cbs, event_cb, next);
> +			if (event_cb->dev_name)
> +				free(event_cb->dev_name);
>   			free(event_cb);
>   			ret++;
>   		} else {


Could you please to check is there another part need to check memory 
leak like that, such as in rte_dev_event_callback_register?



More information about the dev mailing list