perf tools: Fix memory leak in read_ftrace_printk()

get_tracing_file() should be paired with put_tracing_file().

Signed-off-by: Li Zefan <[email protected]>
Acked-by: Frederic Weisbecker <[email protected]>
Cc: Peter Zijlstra <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
Li Zefan 2009-09-17 16:34:23 +08:00 • committed by Ingo Molnar
commit 6706ccf8e7

View file

@ -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 *