From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, <chcchc88@163.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Nithin Dabilpuram <ndabilpuram@marvell.com>,
Zhirun Yan <yanzhirun_163@163.com>
Cc: <dev@dpdk.org>, Pavan Nikhilesh <pbhagavatula@marvell.com>
Subject: [PATCH v2] graph: fix memory leak in node clone
Date: Fri, 1 Nov 2024 13:07:37 +0530 [thread overview]
Message-ID: <20241101073737.2003-1-pbhagavatula@marvell.com> (raw)
In-Reply-To: <20241030121247.1400-1-pbhagavatula@marvell.com>
From: Pavan Nikhilesh <pbhagavatula@marvell.com>
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 <pbhagavatula@marvell.com>
---
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
prev parent reply other threads:[~2024-11-01 7:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-30 12:12 [PATCH] " pbhagavatula
2024-11-01 1:27 ` Huichao cai
2024-11-01 7:37 ` pbhagavatula [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241101073737.2003-1-pbhagavatula@marvell.com \
--to=pbhagavatula@marvell.com \
--cc=chcchc88@163.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=yanzhirun_163@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).