From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1C638A04DD; Wed, 18 Nov 2020 18:02:40 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D6B02C930; Wed, 18 Nov 2020 18:00:37 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 91E91C8B4 for ; Wed, 18 Nov 2020 18:00:25 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from michaelba@nvidia.com) with SMTP; 18 Nov 2020 19:00:19 +0200 Received: from nvidia.com (pegasus07.mtr.labs.mlnx [10.210.16.112]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0AIH0Iwc005874; Wed, 18 Nov 2020 19:00:19 +0200 From: Michael Baum To: dev@dpdk.org Cc: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko Date: Wed, 18 Nov 2020 17:00:11 +0000 Message-Id: <1605718811-18652-7-git-send-email-michaelba@nvidia.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1605718811-18652-1-git-send-email-michaelba@nvidia.com> References: <1605718811-18652-1-git-send-email-michaelba@nvidia.com> Subject: [dpdk-dev] [PATCH 7/7] regex/mlx5: fix QP setuping error flow X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Ori Kam --- drivers/regex/mlx5/mlx5_regex_control.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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); -- 1.8.3.1