mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
perf tools: Fix memory leak when synthesizing thread records
Checking default guest machine should be done before allocating event structures otherwise it'll leak memory. Signed-off-by: Namhyung Kim <[email protected]> Cc: Don Zickus <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joe Mario <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
parent
11c9abf227
commit
574799bfdb
1 changed files with 3 additions and 3 deletions
|
|
@ -446,6 +446,9 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
|
|||
union perf_event *comm_event, *mmap_event, *fork_event;
|
||||
int err = -1;
|
||||
|
||||
if (machine__is_default_guest(machine))
|
||||
return 0;
|
||||
|
||||
comm_event = malloc(sizeof(comm_event->comm) + machine->id_hdr_size);
|
||||
if (comm_event == NULL)
|
||||
goto out;
|
||||
|
|
@ -458,9 +461,6 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
|
|||
if (fork_event == NULL)
|
||||
goto out_free_mmap;
|
||||
|
||||
if (machine__is_default_guest(machine))
|
||||
return 0;
|
||||
|
||||
snprintf(proc_path, sizeof(proc_path), "%s/proc", machine->root_dir);
|
||||
proc = opendir(proc_path);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue