X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Flttng-elf.c;fp=src%2Fcommon%2Flttng-elf.c;h=5d4b93bbb80d13943571fede84f82057dea3a09d;hp=b2aa88487e1dff286c21d0442f6cdf175a68681f;hb=4e0b99ca361319264ef4fca09eaeeaa9e99daa52;hpb=d3faab47a5ff8be82a1a1df16483d1666f21d3a6 diff --git a/src/common/lttng-elf.c b/src/common/lttng-elf.c index b2aa88487..5d4b93bbb 100644 --- a/src/common/lttng-elf.c +++ b/src/common/lttng-elf.c @@ -605,6 +605,7 @@ int lttng_elf_get_section_hdr_by_name(struct lttng_elf *elf, 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) { @@ -615,7 +616,9 @@ int lttng_elf_get_section_hdr_by_name(struct lttng_elf *elf, 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; } }