From: Jiri Olsa <jolsa@redhat.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
stable@vger.kernel.org.#.3.14+, Jiri Olsa <jolsa@redhat.com>
Subject: [PATCH 4/4] tools lib traceevent: Fix memory leak in pretty_print()
Date: Wed, 23 Apr 2014 13:31:22 +0200 [thread overview]
Message-ID: <1398252682-17185-5-git-send-email-jolsa@redhat.com> (raw)
In-Reply-To: <1398252682-17185-1-git-send-email-jolsa@redhat.com>
From: Steven Rostedt <rostedt@goodmis.org>
Commit 12e55569a244 "tools lib traceevent: Use helper trace-seq in print
functions like kernel does" added a extra trace_seq helper to process
string arguments like the kernel does it. But the difference between the
kernel and the userspace library is that the kernel's trace_seq structure
has a static allocated buffer. The userspace one has a dynamically
allocated one. It requires a trace_seq_destroy(), otherwise it produces
a nasty memory leak.
Cc: stable@vger.kernel.org # 3.14+
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20140422192330.6bb09bf8@gandalf.local.home
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
tools/lib/traceevent/event-parse.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index baec7d8..b83184f 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -4344,6 +4344,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
format, len_arg, arg);
trace_seq_terminate(&p);
trace_seq_puts(s, p.buffer);
+ trace_seq_destroy(&p);
arg = arg->next;
break;
default:
--
1.8.3.1
next prev parent reply other threads:[~2014-04-23 11:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-23 11:31 [GIT PULL 0/4] perf/urgent fixes Jiri Olsa
2014-04-23 11:31 ` [PATCH 1/4] perf tests x86: Fix memory leak in sample_ustack() Jiri Olsa
2014-04-23 11:31 ` [PATCH 2/4] perf tools: Disable libdw unwind for all but x86 arch Jiri Olsa
2014-04-23 11:31 ` [PATCH 3/4] tools lib traceevent: Fix backward compatibility macros for pevent filter enums Jiri Olsa
2014-04-23 11:31 ` Jiri Olsa [this message]
2014-04-23 13:09 ` [GIT PULL 0/4] perf/urgent fixes Ingo Molnar
2014-04-23 13:14 ` Ingo Molnar
2014-04-23 13:49 ` Jiri Olsa
2014-04-24 6:36 ` Ingo Molnar
2014-04-24 11:47 ` Jiri Olsa
2014-04-25 8:12 ` Ingo Molnar
2014-04-23 14:53 ` Jiri Olsa
2014-04-24 6:47 ` Ingo Molnar
2014-04-24 11:43 ` Jiri Olsa
2014-04-25 17:50 ` Andi Kleen
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=1398252682-17185-5-git-send-email-jolsa@redhat.com \
--to=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=rostedt@goodmis.org \
--cc=stable@vger.kernel.org.#.3.14+ \
/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).