diff options
author | Brian Carlstrom <bdc@google.com> | 2016-10-14 01:04:26 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2016-10-14 16:51:27 -0700 |
commit | 645e477c2ce7a59ac98bc86463826cf082a13ad8 (patch) | |
tree | 3e46e0bc30d55c81fd4e97536142d5711bebf72e /patchoat | |
parent | 47d522b27febaeb4168b9069550218b3f55e1905 (diff) | |
download | android_art-645e477c2ce7a59ac98bc86463826cf082a13ad8.tar.gz android_art-645e477c2ce7a59ac98bc86463826cf082a13ad8.tar.bz2 android_art-645e477c2ce7a59ac98bc86463826cf082a13ad8.zip |
Ensure OpenDexFilesFromImage closes file to prevent file descriptor leak
Test: m -j32 test-art-host
Bug: 32095919
Change-Id: I44541edeb403a508e1b9794ee09fb1f55e3f42bf
Diffstat (limited to 'patchoat')
-rw-r--r-- | patchoat/patchoat.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/patchoat/patchoat.cc b/patchoat/patchoat.cc index 5bb61bb829..58e1608c8c 100644 --- a/patchoat/patchoat.cc +++ b/patchoat/patchoat.cc @@ -401,7 +401,7 @@ PatchOat::MaybePic PatchOat::IsOatPic(const ElfFile* oat_in) { return ERROR_OAT_FILE; } - const std::string& file_path = oat_in->GetFile().GetPath(); + const std::string& file_path = oat_in->GetFilePath(); const OatHeader* oat_header = GetOatHeader(oat_in); if (oat_header == nullptr) { @@ -804,7 +804,7 @@ bool PatchOat::PatchOatHeader(ElfFileImpl* oat_file) { } OatHeader* oat_header = reinterpret_cast<OatHeader*>(oat_file->Begin() + rodata_sec->sh_offset); if (!oat_header->IsValid()) { - LOG(ERROR) << "Elf file " << oat_file->GetFile().GetPath() << " has an invalid oat header"; + LOG(ERROR) << "Elf file " << oat_file->GetFilePath() << " has an invalid oat header"; return false; } oat_header->RelocateOat(delta_); @@ -812,10 +812,11 @@ bool PatchOat::PatchOatHeader(ElfFileImpl* oat_file) { } bool PatchOat::PatchElf() { - if (oat_file_->Is64Bit()) + if (oat_file_->Is64Bit()) { return PatchElf<ElfFileImpl64>(oat_file_->GetImpl64()); - else + } else { return PatchElf<ElfFileImpl32>(oat_file_->GetImpl32()); + } } template <typename ElfFileImpl> |