From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 16E57A034E; Tue, 22 Feb 2022 19:29:02 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B9D194114F; Tue, 22 Feb 2022 19:28:59 +0100 (CET) Received: from out203-205-251-72.mail.qq.com (out203-205-251-72.mail.qq.com [203.205.251.72]) by mails.dpdk.org (Postfix) with ESMTP id 31B3C40DF4 for ; Tue, 22 Feb 2022 19:28:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1645554535; bh=UqnFCerhqZi1y0ByHk8Co1PFP/x/mIXFKou6KhzBFdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LYVlSFp4znZTJWnqYA7p0YbvjOSQl373LHZXWQz464Jezyp/40ABupA9o6Zjhq2nA NXbmq5y1q0RKt4+BmNvrWIPquYe7lteQYbgb59ik6GlGMFarkNeRSni/hzz2vYqz8a jTV9R9aKVf8ciCvZwewPd4FMFX6jFBaiJIBS7h1U= Received: from localhost.localdomain ([111.193.130.237]) by newxmesmtplogicsvrszb6.qq.com (NewEsmtp) with SMTP id 72532A7A; Wed, 23 Feb 2022 02:28:37 +0800 X-QQ-mid: xmsmtpt1645554531t0lnmr4cz Message-ID: X-QQ-XMAILINFO: NqN/wpVFVRYX4MjMYaqwpjWQSQinB0mjsXnLVc0eTqkwu1VUErXaF/gWrf8OHS 123LY2xyEHCPvS5+Xi8ICx2A8fU9ySRuQBatifs2uADtmcSU0YAqRBRNbDb2WNuPAPiPr5Mz8wj/ RdN1OkKeDGKh4c430bJAOQon0cHEH1rQLPYAByWENjk3q9mTHjOIqpa7sUS5poY3Jc/B6Tv5VYJo E9Y5ZBqdFU4+FTpHPQGkDsm5x9ZtQ00MnwjMNMLx0fytPrEGWWvJojIS+ndjWYB2oJJ9jSgAgIUQ DMN2HrL6yFfR5Q0Hn0VZV3CLWkepcTc33uvarsYrQ3SCp+YJic1qajQzVBJ7+bfr2rWVYM1wKQra HrBj1ySgNfr3JHK+NatQJYdfTB7U1daP7FXs0tTHysTpbG+iFXbDIdTDr5ecObFbnkEPwg2BLzto V5pGrC6h0FIyQ2+sZelXRdQHQyNlZECvqJOMikfebgiUyNE9EyvYoTXLjPcgfcTgbiXi1/x9+VZG yq6uUFUyoDq+tbi1mmW61nz+91zXPg9MPDf9aJVCWiorciDUMK0QVeagOEYXVJZ4faPJK/NnbkPC /gJh2g3O6zQfMQpTDfhHZKaMuhrwCujUnH4d7+SVuHsTp7TMJLozYaS5FDeRKIxpDckLk/ygJDWg +IHvBMIm9yFSitwWkRZZOQumxLLKAUqQoK7oBSbF3SBIGc+jpTCOMshlKaSWBSrAobp7zlcTikOP tR7xZ+L8ZD6mQWaP5RN5+Q7LGPoQTZGhuJ/zaK+2y7klwl5pK+yhU2Jtm22Hcnpk6kLMiuP+2ag/ 9b4kHBRGcGJEehN+IhGf3xMwd7MxgXDXkVHAPgBj/rg27U3D9TiS3TXqqhtNatDccu0ZbOc0gc2R AN68OpoQTRo5YgjoPEr6H0mNXKvBOroQVuXnSERMmy From: Weiguo Li To: dev@dpdk.org Cc: adypodoman@gmail.com, xiaoyun.li@intel.com, tianfei.zhang@intel.com, bruce.richardson@intel.com, ivan.malov@oktetlabs.ru, jgrajcia@cisco.com, hkalra@marvell.com, ying.a.wang@intel.com, ting.xu@intel.com, simei.su@intel.com, qiming.yang@intel.com, motih@mellanox.com, shreyansh.jain@nxp.com, skoteshwar@marvell.com, stephen@networkplumber.org, kalesh-anakkur.purayil@broadcom.com, somnath.kotur@broadcom.com, declan.doherty@intel.com, gakhil@marvell.com, nicolas.chautru@intel.com Subject: [PATCH 20/20] regex/mlx5: fix a memory leak in error handling Date: Wed, 23 Feb 2022 02:28:37 +0800 X-OQ-MSGID: <7684ab121f773f07a534d68616d0402064c28a79.1645551560.git.liwg06@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When rxp_create_mkey() failed the function return, 'ptr' was not freed which caused a memory leak. Fixes: 9fa82d287f65 ("regex/mlx5: move RXP to CrSpace") Signed-off-by: Weiguo Li --- drivers/regex/mlx5/mlx5_rxp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/regex/mlx5/mlx5_rxp.c b/drivers/regex/mlx5/mlx5_rxp.c index ed3af15e40..4da29a2a06 100644 --- a/drivers/regex/mlx5/mlx5_rxp.c +++ b/drivers/regex/mlx5/mlx5_rxp.c @@ -117,8 +117,10 @@ mlx5_regex_rules_db_import(struct rte_regexdev *dev, rte_memcpy(ptr, rule_db, rule_db_len); /* Register umem and create rof mkey. */ ret = rxp_create_mkey(priv, ptr, rule_db_len, /*access=*/7, &mkey); - if (ret < 0) + if (ret < 0) { + rte_free(ptr); return ret; + } for (id = 0; id < priv->nb_engines; id++) { ret = mlx5_devx_regex_rules_program(priv->cdev->ctx, id, -- 2.25.1