Skip to content

Commit b3ea721

Browse files
captain5050namhyung
authored andcommitted
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>
1 parent 830f185 commit b3ea721

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tools/perf/util/symbol-elf.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1447,8 +1447,11 @@ static int dso__process_kernel_symbol(struct dso *dso, struct map *map,
14471447
map__set_mapping_type(curr_map, MAPPING_TYPE__IDENTITY);
14481448
}
14491449
dso__set_symtab_type(curr_dso, dso__symtab_type(dso));
1450-
if (maps__insert(kmaps, curr_map))
1450+
if (maps__insert(kmaps, curr_map)) {
1451+
dso__put(curr_dso);
1452+
map__put(curr_map);
14511453
return -1;
1454+
}
14521455
dsos__add(&maps__machine(kmaps)->dsos, curr_dso);
14531456
dso__set_loaded(curr_dso);
14541457
dso__put(*curr_dsop);

0 commit comments

Comments
 (0)