summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMichalis Niarchos <michael.niarchos@gmail.com>2026-08-07 17:08:35 +0200
committerNamhyung Kim <namhyung@kernel.org>2026-08-12 06:04:16 -0700
commit8564e01efb5d49ebe530950ef96d61f1c1f897ab (patch)
tree4a796d4a81afd4d4255e78b5ea130da96acc7ee8 /tools
parent16a12a54e9a1151a37aab74914a51b86f7f58d0e (diff)
downloadlinux-8564e01efb5d49ebe530950ef96d61f1c1f897ab.tar.gz
linux-8564e01efb5d49ebe530950ef96d61f1c1f897ab.zip
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-kvm.c5
1 files changed, 4 insertions, 1 deletions
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;
}