[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-6706ccf8e776e51e38ffa89fe7dd20e80eb1e860@git.kernel.org>
Date: Thu, 17 Sep 2009 22:35:27 GMT
From: tip-bot for Li Zefan <lizf@...fujitsu.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
fweisbec@...il.com, lizf@...fujitsu.com, peterz@...radead.org,
tglx@...utronix.de, mingo@...e.hu
Subject: [tip:perfcounters/core] perf tools: Fix memory leak in read_ftrace_printk()
Commit-ID: 6706ccf8e776e51e38ffa89fe7dd20e80eb1e860
Gitweb: http://git.kernel.org/tip/6706ccf8e776e51e38ffa89fe7dd20e80eb1e860
Author: Li Zefan <lizf@...fujitsu.com>
AuthorDate: Thu, 17 Sep 2009 16:34:23 +0800
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Fri, 18 Sep 2009 00:30:24 +0200
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@...fujitsu.com>
Acked-by: Frederic Weisbecker <fweisbec@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>
LKML-Reference: <4AB1F48F.4070807@...fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
tools/perf/util/trace-event-info.c | 7 ++++---
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 6c9302a..1fd824c 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 *
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists