From: Michael Baum Date: Sun, 12 Sep 2021 10:36:23 +0000 (+0300) Subject: net/mlx5: fix memory leak on context allocation failure X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=c76db6a4964e91a79d877a009d15d5c62507136a;p=dpdk.git net/mlx5: fix memory leak on context allocation failure In shared device context creation, there is a missing validation when one of the btree memory allocation fails that will cause a memory leak. This adds a proper check to clean resources in case of failure. Fixes: 632f0f19056f ("net/mlx5: manage shared counters in three-level table") Cc: stable@dpdk.org Signed-off-by: Michael Baum Acked-by: Matan Azrad --- diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index f84e061fe7..f0ec2d1279 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1254,6 +1254,8 @@ error: MLX5_ASSERT(sh); if (sh->cnt_id_tbl) mlx5_l3t_destroy(sh->cnt_id_tbl); + if (sh->share_cache.cache.table) + mlx5_mr_btree_free(&sh->share_cache.cache); if (sh->tis) claim_zero(mlx5_devx_cmd_destroy(sh->tis)); if (sh->td)