summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2009-09-17 16:34:23 +0800
committerIngo Molnar <mingo@elte.hu>2009-09-18 00:30:24 +0200
commit6706ccf8e776e51e38ffa89fe7dd20e80eb1e860 (patch)
tree2e329cde9b0f1e589789327b5dec199eb146c8fa /tools
parent40749d0ff49f99c3661b336fe5e5625207bd925a (diff)
downloadlinux-6706ccf8e776e51e38ffa89fe7dd20e80eb1e860.tar.gz
perf tools: Fix memory leak in read_ftrace_printk()
get_tracing_file() should be paired with put_tracing_file().

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <4AB1F48F.4070807@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/trace-event-info.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index 6c9302a7274c..1fd824c1f1c4 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -458,7 +458,7 @@ static void read_proc_kallsyms(void)
 static void read_ftrace_printk(void)
 {
 	unsigned int size, check_size;
-	const char *path;
+	char *path;
 	struct stat st;
 	int ret;
 
@@ -468,14 +468,15 @@ static void read_ftrace_printk(void)
 		/* not found */
 		size = 0;
 		write_or_die(&size, 4);
-		return;
+		goto out;
 	}
 	size = get_size(path);
 	write_or_die(&size, 4);
 	check_size = copy_file(path);
 	if (size != check_size)
 		die("error in size of file '%s'", path);
-
+out:
+	put_tracing_file(path);
 }
 
 static struct tracepoint_path *