diff options
| author | Ryan Mitchell <rtmitchell@google.com> | 2019-05-28 15:42:14 -0700 |
|---|---|---|
| committer | Ryan Mitchell <rtmitchell@google.com> | 2019-05-28 23:00:04 +0000 |
| commit | d1531ac4e8dc8f57eddf06f1b4a9a93ca67a8ae0 (patch) | |
| tree | 4fe92e55c4a352fbb1faaa041d16442faeb6b03e | |
| parent | c6ca823710d49754c3717e9cf3ba11b9c2648825 (diff) | |
| download | system_core-d1531ac4e8dc8f57eddf06f1b4a9a93ca67a8ae0.tar.gz system_core-d1531ac4e8dc8f57eddf06f1b4a9a93ca67a8ae0.tar.bz2 system_core-d1531ac4e8dc8f57eddf06f1b4a9a93ca67a8ae0.zip | |
Fix leak of mapped zip central directories
Memory mapping the central directory of specific APKs caused memory
mappings to build up over time because they were never unmapped
correctly. This is because MappedFile is not calling munmap with the
size of the data after aligning the mmap offset to a page boundary.
Bug: 133463863
Test: install APKs and verify that the entire mapped CD is unmaped
Test: ran aapt2 as daemon and confirmed that mapped CD is unmapped
Change-Id: Icb6cfebe0e8d67160fee34c5e6423d0f05de526b
| -rw-r--r-- | base/mapped_file.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/base/mapped_file.cpp b/base/mapped_file.cpp index 7c65dc3c5..d26e8ba91 100644 --- a/base/mapped_file.cpp +++ b/base/mapped_file.cpp @@ -76,7 +76,7 @@ MappedFile::~MappedFile() { if (base_ != nullptr) UnmapViewOfFile(base_); if (handle_ != nullptr) CloseHandle(handle_); #else - if (base_ != nullptr) munmap(base_, size_); + if (base_ != nullptr) munmap(base_, size_ + offset_); #endif base_ = nullptr; |
