diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 5484fa4385fc70159edaa22bec4b9ac2f8b03f2a..93c8b6fbc799c12c10290a8dbb10d7b429687213 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -370,8 +370,10 @@ static struct thread *__machine__findnew_thread(struct machine *machine, * within thread__init_map_groups to find the thread * leader and that would screwed the rb tree. */ - if (thread__init_map_groups(th, machine)) + if (thread__init_map_groups(th, machine)) { + thread__delete(th); return NULL; + } } return th;