regex/mlx5: fix leak after probing failure
authorMichael Baum <michaelba@nvidia.com>
Tue, 31 Aug 2021 20:38:38 +0000 (23:38 +0300)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 22 Sep 2021 19:21:31 +0000 (21:21 +0200)
In RegEx device probing, there is register read trying after context
device creation.

When the reading fails, the context device was not freed what caused a
memory leak.

Free it.

Fixes: f324162e8e77 ("regex/mlx5: support combined rule file")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
drivers/regex/mlx5/mlx5_regex.c

index f17b6df..8866a4d 100644 (file)
@@ -171,7 +171,7 @@ mlx5_regex_dev_probe(struct rte_device *rte_dev)
                                            MLX5_RXP_CSR_IDENTIFIER, &val);
        if (ret) {
                DRV_LOG(ERR, "CSR read failed!");
-               return -1;
+               goto dev_error;
        }
        if (val == MLX5_RXP_BF2_IDENTIFIER)
                priv->is_bf2 = 1;