]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf symbol-elf: Add missing puts on error path
authorIan Rogers <irogers@google.com>
Sat, 22 Nov 2025 08:19:15 +0000 (00:19 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 3 Dec 2025 19:07:23 +0000 (11:07 -0800)
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>
tools/perf/util/symbol-elf.c

index c5c382c3409a73280cd250200f622ca409d9e745..957143fbf8a07ce525daa54550428a8fd16f3003 100644 (file)
@@ -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);