From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Cc: Wang ShaoBo <bobo.shaobowang@huawei.com>
Subject: [PATCH] libtraceevent: Fix memleak in make_bprint_args()
Date: Fri, 17 Jun 2022 17:51:49 -0400 [thread overview]
Message-ID: <20220617175149.7eb7366e@gandalf.local.home> (raw)
From: Wang ShaoBo <bobo.shaobowang@huawei.com>
Release arg allocated from alloc_arg() when strdup failed in make_bprint_args().
Link: https://lkml.kernel.org/r/20220513023308.2400381-2-bobo.shaobowang@huawei.com
Fixes: 8b43424c32702 ("tools lib traceevent: Remove some die() calls")
Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
src/event-parse.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/event-parse.c b/src/event-parse.c
index 1ba2a78d20a9..4bbf29727e9f 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -4915,8 +4915,10 @@ static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, s
arg->next = NULL;
arg->type = TEP_PRINT_BSTRING;
arg->string.string = strdup(bptr);
- if (!arg->string.string)
+ if (!arg->string.string) {
+ free(arg);
goto out_free;
+ }
bptr += strlen(bptr) + 1;
*next = arg;
next = &arg->next;
--
2.35.1
reply other threads:[~2022-06-17 21:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220617175149.7eb7366e@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=bobo.shaobowang@huawei.com \
--cc=linux-trace-devel@vger.kernel.org \
/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).