From patchwork Fri Jan 12 17:23:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatoly Burakov X-Patchwork-Id: 33688 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 247A2A48C; Fri, 12 Jan 2018 18:23:21 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id D18F5727A for ; Fri, 12 Jan 2018 18:23:19 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jan 2018 09:23:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,349,1511856000"; d="scan'208";a="9147289" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga007.fm.intel.com with ESMTP; 12 Jan 2018 09:23:17 -0800 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id w0CHNGNA002687; Fri, 12 Jan 2018 17:23:16 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w0CHNGSJ012375; Fri, 12 Jan 2018 17:23:16 GMT Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w0CHNGKh012371; Fri, 12 Jan 2018 17:23:16 GMT From: Anatoly Burakov To: dev@dpdk.org Cc: Yipeng Wang , Sameh Gobriel Date: Fri, 12 Jan 2018 17:23:16 +0000 Message-Id: X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <5c0a540f8917604a86e18f8da77fa0c2013b7fde.1513865858.git.anatoly.burakov@intel.com> References: <5c0a540f8917604a86e18f8da77fa0c2013b7fde.1513865858.git.anatoly.burakov@intel.com> Subject: [dpdk-dev] [PATCH v2] member: fix memory leak on error 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" rte_member may have allocated a tailq entry or setum before failure, so free them. Fixes: 857ed6c68cf2 ("member: implement main API") Cc: yipeng1.wang@intel.com Signed-off-by: Anatoly Burakov Acked-by: Yipeng Wang --- Notes: v2: free setsum as well lib/librte_member/rte_member.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/librte_member/rte_member.c b/lib/librte_member/rte_member.c index 0c4c144..bc4cef6 100644 --- a/lib/librte_member/rte_member.c +++ b/lib/librte_member/rte_member.c @@ -162,8 +162,9 @@ rte_member_create(const struct rte_member_parameters *params) return setsum; error_unlock_exit: + rte_free(te); + rte_free(setsum); rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); - rte_member_free(setsum); return NULL; }