lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 29 Jun 2015 10:09:02 -0300
From:	Arnaldo Carvalho de Melo <acme@...nel.org>
To:	taeung <treeze.taeung@...il.com>
Cc:	linux-kernel@...r.kernel.org, jolsa@...hat.com,
	namhyung@...nel.org, Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH] perf session: Fill in the missing freeing a session
 after an error occur

Em Sat, Jun 27, 2015 at 11:08:52PM +0900, taeung escreveu:
> In some cases some sessions aren't freed.
> For example, a session is allocated and then
> if an error occur, just a error value is 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 <treeze.taeung@...il.com>
> ---
>  tools/perf/builtin-inject.c |  7 ++++---
>  tools/perf/builtin-kmem.c   |  4 ++--
>  tools/perf/builtin-kvm.c    | 16 ++++++++++++----
>  tools/perf/builtin-mem.c    | 17 ++++++++++-------
>  tools/perf/builtin-report.c |  6 ++++--
>  5 files changed, 32 insertions(+), 18 deletions(-)

<SNIP>
 
> +++ b/tools/perf/builtin-mem.c
> @@ -135,24 +135,27 @@ static int report_raw_events(struct perf_mem *mem)
>  	if (mem->cpu_list) {
>  		ret = perf_session__cpu_bitmap(session, mem->cpu_list,
>  					       mem->cpu_bitmap);
> -		if (ret)
> +		if (ret) {
> +			ret = err;
>  			goto out_delete;

How come?

Can you break this into per-tool patches? If that would be the case I
would have applied some now.

- Arnaldo

> +		}
>  	}
>  
> -	if (symbol__init(&session->header.env) < 0)
> -		return -1;
> +	ret = symbol__init(&session->header.env);
> +	if (ret < 0)
> +		goto out_delete;
>  
>  	printf("# PID, TID, IP, ADDR, LOCAL WEIGHT, DSRC, SYMBOL\n");
>  
>  	err = perf_session__process_events(session);
>  	if (err)
> -		return err;
> -
> -	return 0;
> +		ret = err;
> +	else
> +		ret = 0;
>  
>  out_delete:
>  	perf_session__delete(session);
> -	return err;
> +	return ret;
>  }
>  
>  static int report_events(int argc, const char **argv, struct perf_mem *mem)
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index 32626ea..610d056 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -828,8 +828,10 @@ repeat:
>  	if (report.header || report.header_only) {
>  		perf_session__fprintf_info(session, stdout,
>  					   report.show_full_info);
> -		if (report.header_only)
> -			return 0;
> +		if (report.header_only) {
> +			ret = 0;
> +			goto error;
> +		}
>  	} else if (use_browser == 0) {
>  		fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n",
>  		      stdout);
> -- 
> 1.9.1
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ