From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: taeung <treeze.taeung@gmail.com>
Cc: linux-kernel@vger.kernel.org, jolsa@redhat.com,
namhyung@kernel.org, Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH] perf session: Fill in the missing freeing a session after an error occur
Date: Mon, 29 Jun 2015 10:09:02 -0300 [thread overview]
Message-ID: <20150629130902.GB11747@kernel.org> (raw)
In-Reply-To: <1435414132-6296-1-git-send-email-treeze.taeung@gmail.com>
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@gmail.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
prev parent reply other threads:[~2015-06-29 13:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-27 14:08 taeung
2015-06-29 13:09 ` Arnaldo Carvalho de Melo [this message]
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=20150629130902.GB11747@kernel.org \
--to=acme@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=treeze.taeung@gmail.com \
/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
all inboxes | Powered by JetHome®