In elf::reader::priv::locate_alt_ctf_debug_info from
src/abg-elf-reader.cc, the resources held by the hdl and fd variables
aren't necessary released because the control-flow gets out of the
loop too early. This patch fixes the problem.
* src/abg-elf-reader.cc
(elf::reader::priv::locate_alt_ctf_debug_info): Reclaim fd and mem
before break. Also, do not try to locate the debug info it's
already been located.
Signed-off-by: Xiaole He <hexiaole@kylinos.cn>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
void
locate_alt_ctf_debug_info()
{
+ if (alt_ctf_section)
+ return;
+
Elf_Scn *section =
elf_helpers::find_section(elf_handle,
".gnu_debuglink",
// unlikely .ctf was designed to be present in stripped file
alt_ctf_section =
elf_helpers::find_section(hdl, ".ctf", SHT_PROGBITS);
- break;
elf_end(hdl);
close(fd);
+
+ if (alt_ctf_section)
+ break;
}
}