提交 03cd2094 编写于 作者: N Namhyung Kim 提交者: Arnaldo Carvalho de Melo

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: NNamhyung 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.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 3cde41b0
...@@ -204,11 +204,28 @@ static void perf_session__delete_threads(struct perf_session *session) ...@@ -204,11 +204,28 @@ static void perf_session__delete_threads(struct perf_session *session)
machine__delete_threads(&session->host_machine); 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) void perf_session__delete(struct perf_session *self)
{ {
perf_session__destroy_kernel_maps(self); perf_session__destroy_kernel_maps(self);
perf_session__delete_dead_threads(self); perf_session__delete_dead_threads(self);
perf_session__delete_threads(self); perf_session__delete_threads(self);
perf_session_env__delete(&self->header.env);
machine__exit(&self->host_machine); machine__exit(&self->host_machine);
close(self->fd); close(self->fd);
free(self); free(self);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册