net/mlx5: fix memory leak on context allocation failure
authorMichael Baum <michaelba@nvidia.com>
Sun, 12 Sep 2021 10:36:23 +0000 (13:36 +0300)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 20 Sep 2021 14:33:40 +0000 (16:33 +0200)
commitc76db6a4964e91a79d877a009d15d5c62507136a
tree6d995ecb10d1ebfe9af8e1521f186c74f50e4f65
parentdbd29c42bae3cddeceebfe26cf719152afee5a78
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 <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/net/mlx5/mlx5.c