From 8564e01efb5d49ebe530950ef96d61f1c1f897ab Mon Sep 17 00:00:00 2001 From: Michalis Niarchos Date: Fri, 7 Aug 2026 17:08:35 +0200 Subject: 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 Signed-off-by: Namhyung Kim --- tools/perf/builtin-kvm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 00baafb05603..66d2dafc8be9 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c @@ -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; } -- cgit