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 C3F6245C47; Fri, 1 Nov 2024 08:54:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 90849402C3; Fri, 1 Nov 2024 08:54:37 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 80D2D40264 for ; Fri, 1 Nov 2024 08:54:35 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49V9le7E009138; Fri, 1 Nov 2024 00:54:29 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=8 qtZe3m0o+gJAlnyr6KOY+6jKC3hZkkXrY8TlMH9RYY=; b=LIRgw78D9wFMttFsB IiFaxuzC2HazgmyKNsX+NJY7Pg8Y5CrdzdL8I/isa8ZUhabZ5ce2pXL1lyJMH+v4 oKYNuLBWdbUbNQpc25pL0uARXJxnWeUtIy1T+ZfJ9G3G6T1f1DvJPog0s7S34v/X irBB5XLk+2PGvKh4qs5GkgUI2gSfvY5ZwJDEznE33aS2JbgRwOyBA9MVGl+9NT3w nHh9DFpssKE1J4vJW7upQcVmi6iF+cQUMpLsEnDKy/4IIdvT/NNF1L4N86osJTYI VcFVwvezSnnXsRhNhDHNW8gByeiXT6j2HXi5UPgD3QyZTTK+RPClTaNHUJ7/0K7o OVmpg== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 42kfwh6178-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 01 Nov 2024 00:54:28 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 1 Nov 2024 00:54:27 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Fri, 1 Nov 2024 00:54:27 -0700 Received: from MININT-80QBFE8.corp.innovium.com (MININT-80QBFE8.marvell.com [10.28.164.106]) by maili.marvell.com (Postfix) with ESMTP id E38825B6C61; Fri, 1 Nov 2024 00:37:38 -0700 (PDT) From: To: , , Kiran Kumar K , Nithin Dabilpuram , Zhirun Yan CC: , Pavan Nikhilesh Subject: [PATCH v2] graph: fix memory leak in node clone Date: Fri, 1 Nov 2024 13:07:37 +0530 Message-ID: <20241101073737.2003-1-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241030121247.1400-1-pbhagavatula@marvell.com> References: <20241030121247.1400-1-pbhagavatula@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: LG3QDY_G0XliCNVzmMOWOMqdAjxi2sCr X-Proofpoint-GUID: LG3QDY_G0XliCNVzmMOWOMqdAjxi2sCr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 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 From: Pavan Nikhilesh Free memory allocated for the node when xstats memory allocation fails. Coverity issue: 445529 Fixes: 070db97e017b ("graph: support node xstats") Signed-off-by: Pavan Nikhilesh --- v2 Changes: - Fix one more leak. (Huichao cai) lib/graph/node.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/graph/node.c b/lib/graph/node.c index f15922892e..63db629da8 100644 --- a/lib/graph/node.c +++ b/lib/graph/node.c @@ -156,7 +156,7 @@ node_clone(struct node *node, const char *name) (node->xstats->nb_xstats * RTE_NODE_XSTAT_DESC_SIZE)); if (reg->xstats == NULL) { rte_errno = ENOMEM; - goto fail; + goto free; } for (i = 0; i < node->xstats->nb_xstats; i++) @@ -178,7 +178,7 @@ node_clone(struct node *node, const char *name) /* Naming ceremony of the new node. name is node->name + "-" + name */ if (clone_name(reg->name, node->name, name)) - goto free; + goto free_xstat; rc = __rte_node_register(reg); free_xstat: -- 2.25.1