From: Miaoqian Lin <linmq006@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: linmq006@gmail.com, Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] tracing: Fix possible memory leak in __create_synth_event
Date: Fri, 26 Nov 2021 10:47:08 +0000 [thread overview]
Message-ID: <20211126104708.7899-1-linmq006@gmail.com> (raw)
Before goto err, call argv_free to handle argv in order to prevent
memory leak.
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
kernel/trace/trace_events_synth.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c
index 22db3ce95e74..fe2e37564c9b 100644
--- a/kernel/trace/trace_events_synth.c
+++ b/kernel/trace/trace_events_synth.c
@@ -1261,6 +1261,7 @@ static int __create_synth_event(const char *name, const char *raw_fields)
*/
if (cmd_version > 1 && n_fields_this_loop >= 1) {
synth_err(SYNTH_ERR_INVALID_CMD, errpos(field_str));
+ argv_free(argv);
ret = -EINVAL;
goto err;
}
@@ -1268,6 +1269,7 @@ static int __create_synth_event(const char *name, const char *raw_fields)
fields[n_fields++] = field;
if (n_fields == SYNTH_FIELDS_MAX) {
synth_err(SYNTH_ERR_TOO_MANY_FIELDS, 0);
+ argv_free(argv);
ret = -EINVAL;
goto err;
}
@@ -1277,6 +1279,7 @@ static int __create_synth_event(const char *name, const char *raw_fields)
if (consumed < argc) {
synth_err(SYNTH_ERR_INVALID_CMD, 0);
+ argv_free(argv);
ret = -EINVAL;
goto err;
}
--
2.17.1
next reply other threads:[~2021-11-26 11:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-26 10:47 Miaoqian Lin [this message]
2021-12-08 20:44 ` [PATCH] tracing: Fix possible memory leak in __create_synth_event Steven Rostedt
2021-12-09 2:43 ` [PATCH v2] " Miaoqian Lin
2021-12-09 15:42 ` Steven Rostedt
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=20211126104708.7899-1-linmq006@gmail.com \
--to=linmq006@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.