Commit 6706ccf8 authored by Li Zefan's avatar Li Zefan Committed by Ingo Molnar

perf tools: Fix memory leak in read_ftrace_printk()

get_tracing_file() should be paired with put_tracing_file().
Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
Acked-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <4AB1F48F.4070807@cn.fujitsu.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 40749d0f
...@@ -458,7 +458,7 @@ static void read_proc_kallsyms(void) ...@@ -458,7 +458,7 @@ static void read_proc_kallsyms(void)
static void read_ftrace_printk(void) static void read_ftrace_printk(void)
{ {
unsigned int size, check_size; unsigned int size, check_size;
const char *path; char *path;
struct stat st; struct stat st;
int ret; int ret;
...@@ -468,14 +468,15 @@ static void read_ftrace_printk(void) ...@@ -468,14 +468,15 @@ static void read_ftrace_printk(void)
/* not found */ /* not found */
size = 0; size = 0;
write_or_die(&size, 4); write_or_die(&size, 4);
return; goto out;
} }
size = get_size(path); size = get_size(path);
write_or_die(&size, 4); write_or_die(&size, 4);
check_size = copy_file(path); check_size = copy_file(path);
if (size != check_size) if (size != check_size)
die("error in size of file '%s'", path); die("error in size of file '%s'", path);
out:
put_tracing_file(path);
} }
static struct tracepoint_path * static struct tracepoint_path *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment