lttng_elf_get_section_name() returns a dynamically-allocated section
name. However, lttng_elf_get_section_hdr_by_name() never frees
this returned section name.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
char *curr_section_name;
for (i = 0; i < elf->ehdr->e_shnum; ++i) {
+ bool name_equal;
int ret = lttng_elf_get_section_hdr(elf, i, section_hdr);
if (ret) {
if (!curr_section_name) {
continue;
}
- if (strcmp(curr_section_name, section_name) == 0) {
+ name_equal = strcmp(curr_section_name, section_name) == 0;
+ free(curr_section_name);
+ if (name_equal) {
return 0;
}
}