summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2025-11-22 00:19:15 -0800
committerNamhyung Kim <namhyung@kernel.org>2025-12-03 11:07:23 -0800
commitb3ea721b804f9b7ae1de2a651aa4aca9bf5ff04b (patch)
tree667940bfd5f6512370cfa81351a8a4bfd50e6b0b
parent830f1854c4a02d70d2d7d7e2e8f71cb3b928c0d6 (diff)
perf symbol-elf: Add missing puts on error path
In dso__process_kernel_symbol if inserting a map fails, probably ENOMEM, then the reference count puts were missing on the dso and map. Signed-off-by: Ian Rogers <irogers@google.com> Reviewed-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
-rw-r--r--tools/perf/util/symbol-elf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index c5c382c3409a..957143fbf8a0 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -1447,8 +1447,11 @@ static int dso__process_kernel_symbol(struct dso *dso, struct map *map,
map__set_mapping_type(curr_map, MAPPING_TYPE__IDENTITY);
}
dso__set_symtab_type(curr_dso, dso__symtab_type(dso));
- if (maps__insert(kmaps, curr_map))
+ if (maps__insert(kmaps, curr_map)) {
+ dso__put(curr_dso);
+ map__put(curr_map);
return -1;
+ }
dsos__add(&maps__machine(kmaps)->dsos, curr_dso);
dso__set_loaded(curr_dso);
dso__put(*curr_dsop);