Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1174453 > unrolled thread

Re: [PATCH 3/5] perf kvm: Fill in the missing freeing a session after an error occur

Started byJiri Olsa <jolsa@redhat.com>
First post2015-06-30 13:20 +0200
Last post2015-06-30 13:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 3/5] perf kvm: Fill in the missing freeing a session  after an error occur Jiri Olsa <jolsa@redhat.com> - 2015-06-30 13:20 +0200

#1174453 — Re: [PATCH 3/5] perf kvm: Fill in the missing freeing a session after an error occur

FromJiri Olsa <jolsa@redhat.com>
Date2015-06-30 13:20 +0200
SubjectRe: [PATCH 3/5] perf kvm: Fill in the missing freeing a session after an error occur
Message-ID<pH1K2-ax-17@gated-at.bofh.it>
On Tue, Jun 30, 2015 at 05:15:22PM +0900, Taeung Song wrote:
> When an error occur a error value is just returned
> without freeing the session. So allocating and freeing
> session have to be matched as a pair even if an error occur.
> 
> Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
> ---
>  tools/perf/builtin-kvm.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
> index 74878cd..5fa96a0 100644
> --- a/tools/perf/builtin-kvm.c
> +++ b/tools/perf/builtin-kvm.c
> @@ -1061,8 +1061,10 @@ static int read_events(struct perf_kvm_stat *kvm)
>  
>  	symbol__init(&kvm->session->header.env);
>  
> -	if (!perf_session__has_traces(kvm->session, "kvm record"))
> -		return -EINVAL;
> +	if (!perf_session__has_traces(kvm->session, "kvm record")) {
> +		ret = -EINVAL;
> +		goto out_delete;
> +	}
>  
>  	/*
>  	 * Do not use 'isa' recorded in kvm_exit tracepoint since it is not
> @@ -1070,9 +1072,15 @@ static int read_events(struct perf_kvm_stat *kvm)
>  	 */
>  	ret = cpu_isa_config(kvm);
>  	if (ret < 0)
> -		return ret;
> +		goto out_delete;
>  
> -	return perf_session__process_events(kvm->session);
> +	ret = perf_session__process_events(kvm->session);
> +	if (ret < 0)
> +		goto out_delete;

above 2 lines are not needed.. just fall through

jirka

> +
> +out_delete:
> +	perf_session__delete(kvm->session);
> +	return ret;
>  }
>  
>  static int parse_target_str(struct perf_kvm_stat *kvm)
> -- 
> 1.9.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web