linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools lib traceevent: Fix memory leak in pretty_print()
@ 2014-04-22 23:23 Steven Rostedt
  2014-04-23 13:14 ` [tip:perf/urgent] " tip-bot for Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2014-04-22 23:23 UTC (permalink / raw)
  To: LKML; +Cc: Ingo Molnar, Jiri Olsa, Arnaldo Carvalho de Melo, Namhyung Kim


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>
---
 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.1.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:perf/urgent] tools lib traceevent: Fix memory leak in pretty_print()
  2014-04-22 23:23 [PATCH] tools lib traceevent: Fix memory leak in pretty_print() Steven Rostedt
@ 2014-04-23 13:14 ` tip-bot for Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Steven Rostedt @ 2014-04-23 13:14 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, rostedt, tglx, jolsa

Commit-ID:  de04f8657de9d3351a2d5880f1f7080b23b798cf
Gitweb:     http://git.kernel.org/tip/de04f8657de9d3351a2d5880f1f7080b23b798cf
Author:     Steven Rostedt <rostedt@goodmis.org>
AuthorDate: Tue, 22 Apr 2014 19:23:30 -0400
Committer:  Jiri Olsa <jolsa@redhat.com>
CommitDate: Wed, 23 Apr 2014 13:19:30 +0200

tools lib traceevent: Fix memory leak in pretty_print()

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:

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-23 13:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-22 23:23 [PATCH] tools lib traceevent: Fix memory leak in pretty_print() Steven Rostedt
2014-04-23 13:14 ` [tip:perf/urgent] " tip-bot for Steven Rostedt

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).