Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Commit

Permalink
[Xposed] Close .oat files after reading their header
Browse files Browse the repository at this point in the history
Otherwise, resources will be exhausted sooner or later on some ROMs.
This can lead to bootloops or sudden restarts.

Some parts of the code were copied from OpenDexFilesFromImage(), which opens
the file for later use. But in OatHeader::FromFile(), we just want to read
the header and then close the file again.

Fixes rovo89/Xposed#31
  • Loading branch information
rovo89 committed Apr 30, 2015
1 parent d586da3 commit 55b5e0b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/oat.cc
Expand Up @@ -71,7 +71,7 @@ OatHeader* OatHeader::FromFile(const std::string& filename, std::string* error_m
*error_msg = StringPrintf("Could not get oat header because file could not be opened: %s", filename.c_str());
return nullptr;
}
std::unique_ptr<ElfFile> elf_file(ElfFile::Open(file.release(), false, false, error_msg));
std::unique_ptr<ElfFile> elf_file(ElfFile::Open(file.get(), false, false, error_msg));
if (elf_file.get() == nullptr) {
return nullptr;
}
Expand Down

0 comments on commit 55b5e0b

Please sign in to comment.