tools lib traceevent: Fix memory leak in pretty_print()
PATCH 1/1 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.
--- tools/lib/traceevent/event-parse.c | 1 + 1 file changed, 1 insertion(+)
tools/lib/traceevent/event-parse.c +1 -0
@@ -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 :
Signature · 1 line
1.8.1.4
tip-bot for Steven Rostedt
merge bottools lib traceevent: Fix memory leak in pretty_print()
Commit-ID: de04f8657de9d3351a2d5880f1f7080b23b798cf Gitweb: http://git.kernel.org/tip/de04f8657de9d3351a2d5880f1f7080b23b798cf Author: Steven Rostedt <[email protected]> AuthorDate: Tue, 22 Apr 2014 19:23:30 -0400 Committer: Jiri Olsa <[email protected]> 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.
--- tools/lib/traceevent/event-parse.c | 1 + 1 file changed, 1 insertion(+)
tools/lib/traceevent/event-parse.c +1 -0
@@ -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 :