diff --git a/openmp/libomptarget/plugins/common/elf_common.c b/openmp/libomptarget/plugins/common/elf_common.c --- a/openmp/libomptarget/plugins/common/elf_common.c +++ b/openmp/libomptarget/plugins/common/elf_common.c @@ -45,6 +45,7 @@ // Check if ELF is the right kind. if (elf_kind(e) != ELF_K_ELF) { DP("Unexpected ELF type!\n"); + elf_end(e); return 0; } Elf64_Ehdr *eh64 = elf64_getehdr(e);