summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-11-21 13:43:19 +0900
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-12-09 08:46:05 -0300
commit03cd20949964f5cda600a56e12ffac39dfec4cb0 (patch)
tree927836caa449f4062108090d023f5b8883bc49c5 /tools/perf/util/session.c
parent3cde41b0d63d0550ac9c8352f1ce0ea516690f46 (diff)
downloadtalos-op-linux-03cd20949964f5cda600a56e12ffac39dfec4cb0.tar.gz
talos-op-linux-03cd20949964f5cda600a56e12ffac39dfec4cb0.zip
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>
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r--tools/perf/util/session.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index ce6f51162386..d5fb60760bac 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);
OpenPOWER on IntegriCloud