perf kvm: Fix memory leak in process_sample_event()

machine__resolve() indirectly acquires a thread reference via
machine__findnew_thread(). Release it, as suggested by the documentation
of the former.

Signed-off-by: Michalis Niarchos <michael.niarchos@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
Michalis Niarchos 2026-08-07 17:08:35 +02:00 committed by Namhyung Kim
parent 16a12a54e9
commit 8564e01efb

View File

@ -1153,13 +1153,16 @@ static int process_sample_event(const struct perf_tool *tool,
pr_debug("problem processing %s (%u) event at offset %#" PRIx64 ", skipping it.\n",
perf_event__name(event->header.type), event->header.type,
sample->file_offset);
return -1;
err = -1;
goto out;
}
if (!handle_kvm_event(kvm, thread, sample))
err = -1;
thread__put(thread);
out:
addr_location__exit(&kvm->al);
return err;
}