public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Namhyung Kim <namhyung.kim@lge.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com,
	mingo@kernel.org, andi@firstfloor.org, peterz@infradead.org,
	namhyung.kim@lge.com, namhyung@kernel.org, tglx@linutronix.de,
	feng.tang@intel.com
Subject: [tip:perf/core] perf session: Free environment information when deleting session
Date: Thu, 24 Jan 2013 10:39:36 -0800	[thread overview]
Message-ID: <tip-03cd20949964f5cda600a56e12ffac39dfec4cb0@git.kernel.org> (raw)
In-Reply-To: <1353472999-23042-1-git-send-email-namhyung@kernel.org>

Commit-ID:  03cd20949964f5cda600a56e12ffac39dfec4cb0
Gitweb:     http://git.kernel.org/tip/03cd20949964f5cda600a56e12ffac39dfec4cb0
Author:     Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Wed, 21 Nov 2012 13:43:19 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sun, 9 Dec 2012 08:46:05 -0300

perf session: Free environment information when deleting session

The perf session environment information was saved (so allocated) during
perf_session__open, but was not freed.  As free(3) handles NULL pointer
input properly it won't cause a issue for writing modes - e.g. perf
record

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Feng Tang <feng.tang@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1353472999-23042-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/session.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index ce6f511..d5fb607 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -204,11 +204,28 @@ static void perf_session__delete_threads(struct perf_session *session)
 	machine__delete_threads(&session->host_machine);
 }
 
+static void perf_session_env__delete(struct perf_session_env *env)
+{
+	free(env->hostname);
+	free(env->os_release);
+	free(env->version);
+	free(env->arch);
+	free(env->cpu_desc);
+	free(env->cpuid);
+
+	free(env->cmdline);
+	free(env->sibling_cores);
+	free(env->sibling_threads);
+	free(env->numa_nodes);
+	free(env->pmu_mappings);
+}
+
 void perf_session__delete(struct perf_session *self)
 {
 	perf_session__destroy_kernel_maps(self);
 	perf_session__delete_dead_threads(self);
 	perf_session__delete_threads(self);
+	perf_session_env__delete(&self->header.env);
 	machine__exit(&self->host_machine);
 	close(self->fd);
 	free(self);

      reply	other threads:[~2013-01-24 18:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-20  9:31 [PATCH 1/3] perf session: Add perf_session__delete_env Feng Tang
2012-11-20  9:31 ` [PATCH 2/3] perf hists browser: Add option for runtime switching perf data file Feng Tang
2012-11-20 15:16   ` Arnaldo Carvalho de Melo
2012-11-20 16:16     ` Feng Tang
2012-11-20 16:24     ` Feng Tang
2012-11-20  9:31 ` [PATCH 3/3] perf report: Enable the runtime switching of " Feng Tang
2012-11-20 15:13 ` [PATCH 1/3] perf session: Add perf_session__delete_env Arnaldo Carvalho de Melo
2012-11-20 15:20   ` Namhyung Kim
2012-11-21  4:43     ` [PATCH v2 1/3] perf session: Free environment information when deleting session Namhyung Kim
2013-01-24 18:39       ` tip-bot for Namhyung Kim [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=tip-03cd20949964f5cda600a56e12ffac39dfec4cb0@git.kernel.org \
    --to=namhyung.kim@lge.com \
    --cc=acme@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=feng.tang@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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