diff --git a/core/src/main/cpp/main/src/elf_util.cpp b/core/src/main/cpp/main/src/elf_util.cpp index f8346c39..903fb159 100644 --- a/core/src/main/cpp/main/src/elf_util.cpp +++ b/core/src/main/cpp/main/src/elf_util.cpp @@ -248,9 +248,8 @@ bool ElfImg::findModuleBase() { } } } - if (buff) free(buff); - if (!found) { + if (buff) free(buff); LOGE("failed to read load address for %s", elf.data()); fclose(maps); return false; @@ -260,6 +259,8 @@ bool ElfImg::findModuleBase() { LOGE("failed to read load address for %s", elf.data()); } + if (buff) free(buff); + fclose(maps); LOGD("get module base %s: %lx", elf.data(), load_addr);