public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] perf tools: Fix memory leak in read_ftrace_printk()
Date: Thu, 17 Sep 2009 11:01:50 +0200	[thread overview]
Message-ID: <20090917090149.GB5184@nowhere> (raw)
In-Reply-To: <4AB1F48F.4070807@cn.fujitsu.com>

On Thu, Sep 17, 2009 at 04:34:23PM +0800, Li Zefan wrote:
> 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>


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


  parent reply	other threads:[~2009-09-17  9:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-17  8:34 [PATCH 1/2] perf tools: Fix memory leak in read_ftrace_printk() Li Zefan
2009-09-17  8:34 ` [PATCH 2/2] perf tools: Increase MAX_EVENT_LENGTH Li Zefan
2009-09-17  9:02   ` Frederic Weisbecker
2009-09-17  9:08     ` Peter Zijlstra
2009-09-17  9:13       ` Frederic Weisbecker
2009-09-17  9:23         ` Li Zefan
2009-09-17 22:35   ` [tip:perfcounters/core] " tip-bot for Li Zefan
2009-09-17  9:01 ` Frederic Weisbecker [this message]
2009-09-17 22:35 ` [tip:perfcounters/core] perf tools: Fix memory leak in read_ftrace_printk() tip-bot for Li Zefan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090917090149.GB5184@nowhere \
    --to=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox