diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2012-11-20 23:43:19 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-12-09 06:46:05 -0500 |
commit | 03cd20949964f5cda600a56e12ffac39dfec4cb0 (patch) | |
tree | 927836caa449f4062108090d023f5b8883bc49c5 /tools/perf/util/session.c | |
parent | 3cde41b0d63d0550ac9c8352f1ce0ea516690f46 (diff) |
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.c | 17 |
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) | |||
204 | machine__delete_threads(&session->host_machine); | 204 | machine__delete_threads(&session->host_machine); |
205 | } | 205 | } |
206 | 206 | ||
207 | static void perf_session_env__delete(struct perf_session_env *env) | ||
208 | { | ||
209 | free(env->hostname); | ||
210 | free(env->os_release); | ||
211 | free(env->version); | ||
212 | free(env->arch); | ||
213 | free(env->cpu_desc); | ||
214 | free(env->cpuid); | ||
215 | |||
216 | free(env->cmdline); | ||
217 | free(env->sibling_cores); | ||
218 | free(env->sibling_threads); | ||
219 | free(env->numa_nodes); | ||
220 | free(env->pmu_mappings); | ||
221 | } | ||
222 | |||
207 | void perf_session__delete(struct perf_session *self) | 223 | void perf_session__delete(struct perf_session *self) |
208 | { | 224 | { |
209 | perf_session__destroy_kernel_maps(self); | 225 | perf_session__destroy_kernel_maps(self); |
210 | perf_session__delete_dead_threads(self); | 226 | perf_session__delete_dead_threads(self); |
211 | perf_session__delete_threads(self); | 227 | perf_session__delete_threads(self); |
228 | perf_session_env__delete(&self->header.env); | ||
212 | machine__exit(&self->host_machine); | 229 | machine__exit(&self->host_machine); |
213 | close(self->fd); | 230 | close(self->fd); |
214 | free(self); | 231 | free(self); |