]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
perf tools: Fix memory leak in read_ftrace_printk()
authorLi Zefan <lizf@cn.fujitsu.com>
Thu, 17 Sep 2009 08:34:23 +0000 (16:34 +0800)
committerIngo Molnar <mingo@elte.hu>
Thu, 17 Sep 2009 22:30:24 +0000 (00:30 +0200)
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>
tools/perf/util/trace-event-info.c

index 6c9302a7274cd6f243bae40f08d07d40501e692c..1fd824c1f1c48e2ffc9224c4185b7ff59883bf2e 100644 (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 *