[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1348540748-4750-1-git-send-email-namhyung@kernel.org>
Date: Tue, 25 Sep 2012 11:39:08 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Paul Mackerras <paulus@...ba.org>,
Ingo Molnar <mingo@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
Namhyung Kim <namhyung.kim@....com>
Subject: [PATCH] perf session: Add perf_session__delete_env
From: Namhyung Kim <namhyung.kim@....com>
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@...nel.org>
---
tools/perf/util/session.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 3049b0ae7003..568037750d12 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -204,11 +204,30 @@ static void perf_session__delete_threads(struct perf_session *session)
machine__delete_threads(&session->host_machine);
}
+static void perf_session__delete_env(struct perf_session *self)
+{
+ struct perf_session_env *env = &self->header.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__delete_env(self);
machine__exit(&self->host_machine);
close(self->fd);
free(self);
--
1.7.11.4
--
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