mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 17:41:50 +00:00
perf machine: Free root_dir in machine__init() error path
Free root_dir in machine__init() error path. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20180215122635.24029-4-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
c396296146
commit
81f981d7ec
1 changed files with 7 additions and 1 deletions
|
@ -50,6 +50,8 @@ static void machine__threads_init(struct machine *machine)
|
||||||
|
|
||||||
int machine__init(struct machine *machine, const char *root_dir, pid_t pid)
|
int machine__init(struct machine *machine, const char *root_dir, pid_t pid)
|
||||||
{
|
{
|
||||||
|
int err = -ENOMEM;
|
||||||
|
|
||||||
memset(machine, 0, sizeof(*machine));
|
memset(machine, 0, sizeof(*machine));
|
||||||
map_groups__init(&machine->kmaps, machine);
|
map_groups__init(&machine->kmaps, machine);
|
||||||
RB_CLEAR_NODE(&machine->rb_node);
|
RB_CLEAR_NODE(&machine->rb_node);
|
||||||
|
@ -79,7 +81,7 @@ int machine__init(struct machine *machine, const char *root_dir, pid_t pid)
|
||||||
char comm[64];
|
char comm[64];
|
||||||
|
|
||||||
if (thread == NULL)
|
if (thread == NULL)
|
||||||
return -ENOMEM;
|
goto out;
|
||||||
|
|
||||||
snprintf(comm, sizeof(comm), "[guest/%d]", pid);
|
snprintf(comm, sizeof(comm), "[guest/%d]", pid);
|
||||||
thread__set_comm(thread, comm, 0);
|
thread__set_comm(thread, comm, 0);
|
||||||
|
@ -87,7 +89,11 @@ int machine__init(struct machine *machine, const char *root_dir, pid_t pid)
|
||||||
}
|
}
|
||||||
|
|
||||||
machine->current_tid = NULL;
|
machine->current_tid = NULL;
|
||||||
|
err = 0;
|
||||||
|
|
||||||
|
out:
|
||||||
|
if (err)
|
||||||
|
zfree(&machine->root_dir);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue