Skip to content

Commit

Permalink
perf tools: Fix memory leak in read_ftrace_printk()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Li Zefan authored and Ingo Molnar committed Sep 17, 2009
1 parent 40749d0 commit 6706ccf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/perf/util/trace-event-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 *
Expand Down

0 comments on commit 6706ccf

Please sign in to comment.