compress/mlx5: fix leak on QP setup failure
authorMichael Baum <michaelba@nvidia.com>
Tue, 31 Aug 2021 20:39:41 +0000 (23:39 +0300)
committerAkhil Goyal <gakhil@marvell.com>
Mon, 6 Sep 2021 19:46:34 +0000 (21:46 +0200)
commit12b253ee876f3e687524a12fd670ffc65f0aed4d
tree0acad0253cb3628a054650fdba16871e1bbb50ff
parent80d56d2d359272f7fabaffdbd810c9d5544644da
compress/mlx5: fix leak on QP setup failure

The QP setup function allocates buffer for its
opaque MR and register it into MR structure.

After buffer allocation and before MR registration,
it tries allocate MR Btree.
When the MR Btree allocation fails, the buffer was
not freed what caused a memory leak.

Allocate the MR Btree before buffer alloction.

Fixes: 0165bccdb45f ("compress/mlx5: add memory region management")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/compress/mlx5/mlx5_compress.c