[7/7] regex/mlx5: fix QP setuping error flow
diff mbox series

Message ID 1605718811-18652-7-git-send-email-michaelba@nvidia.com
State Accepted
Delegated to: Thomas Monjalon
Headers show
Series
  • [1/7] regex/mlx5: fix jump to the wrong label
Related show

Checks

Context Check Description
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-testing warning Testing issues
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Michael Baum Nov. 18, 2020, 5 p.m. UTC
In regex QP setup, the PMD creates some SQ objects.

When SQ object creation is failed, the previous SQ objects memory were
not freed what caused a memory leak.

Free them.

Fixes: 54fa1f6a67d7 ("regex/mlx5: add teardown for fastpath buffers")

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 drivers/regex/mlx5/mlx5_regex_control.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Patch
diff mbox series

diff --git a/drivers/regex/mlx5/mlx5_regex_control.c b/drivers/regex/mlx5/mlx5_regex_control.c
index 88b3d1a..d6f452b 100644
--- a/drivers/regex/mlx5/mlx5_regex_control.c
+++ b/drivers/regex/mlx5/mlx5_regex_control.c
@@ -336,6 +336,7 @@ 
 	struct mlx5_regex_priv *priv = dev->data->dev_private;
 	struct mlx5_regex_qp *qp;
 	int i;
+	int nb_sq_config = 0;
 	int ret;
 	uint16_t log_desc;
 
@@ -364,8 +365,9 @@ 
 		ret = regex_ctrl_create_sq(priv, qp, i, log_desc);
 		if (ret) {
 			DRV_LOG(ERR, "Can't create sq.");
-			goto err_sq;
+			goto err_btree;
 		}
+		nb_sq_config++;
 	}
 
 	ret = mlx5_mr_btree_init(&qp->mr_ctrl.cache_bh, MLX5_MR_BTREE_CACHE_N,
@@ -385,9 +387,8 @@ 
 err_fp:
 	mlx5_mr_btree_free(&qp->mr_ctrl.cache_bh);
 err_btree:
-	for (i = 0; i < qp->nb_obj; i++)
+	for (i = 0; i < nb_sq_config; i++)
 		regex_ctrl_destroy_sq(priv, qp, i);
-err_sq:
 	regex_ctrl_destroy_cq(priv, &qp->cq);
 err_cq:
 	rte_free(qp->sqs);