From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com,
mingo@kernel.org, jmario@redhat.com, namhyung@kernel.org,
jolsa@redhat.com, tglx@linutronix.de, dzickus@redhat.com
Subject: [tip:perf/core] perf tools: Fix memory leak when synthesizing thread records
Date: Wed, 19 Mar 2014 06:07:35 -0700 [thread overview]
Message-ID: <tip-574799bfdbc3a13e0b5e2f6af34b761bde743a9a@git.kernel.org> (raw)
In-Reply-To: <87ob15tx6a.fsf@sejong.aot.lge.com>
Commit-ID: 574799bfdbc3a13e0b5e2f6af34b761bde743a9a
Gitweb: http://git.kernel.org/tip/574799bfdbc3a13e0b5e2f6af34b761bde743a9a
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Mon, 17 Mar 2014 10:45:49 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 18 Mar 2014 18:17:01 -0300
perf tools: Fix memory leak when synthesizing thread records
Checking default guest machine should be done before allocating event
structures otherwise it'll leak memory.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Joe Mario <jmario@redhat.com>
Link: http://lkml.kernel.org/r/87ob15tx6a.fsf@sejong.aot.lge.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/event.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index ebb48a6..9d12aa6 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -446,6 +446,9 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
union perf_event *comm_event, *mmap_event, *fork_event;
int err = -1;
+ if (machine__is_default_guest(machine))
+ return 0;
+
comm_event = malloc(sizeof(comm_event->comm) + machine->id_hdr_size);
if (comm_event == NULL)
goto out;
@@ -458,9 +461,6 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
if (fork_event == NULL)
goto out_free_mmap;
- if (machine__is_default_guest(machine))
- return 0;
-
snprintf(proc_path, sizeof(proc_path), "%s/proc", machine->root_dir);
proc = opendir(proc_path);
next prev parent reply other threads:[~2014-03-19 13:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-14 14:43 [PATCH V2] perf: Speed up thread map generation Don Zickus
2014-03-14 16:12 ` Jiri Olsa
2014-03-17 1:45 ` Namhyung Kim
2014-03-18 13:43 ` Arnaldo Carvalho de Melo
2014-03-18 14:20 ` Namhyung Kim
2014-03-19 13:07 ` tip-bot for Namhyung Kim [this message]
2014-03-18 8:31 ` [tip:perf/core] perf tools: " tip-bot for Don Zickus
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=tip-574799bfdbc3a13e0b5e2f6af34b761bde743a9a@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=dzickus@redhat.com \
--cc=hpa@zytor.com \
--cc=jmario@redhat.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
/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
Powered by JetHome