diff options
author | George Burgess IV <gbiv@google.com> | 2020-09-03 00:21:42 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-09-03 00:21:42 +0000 |
commit | 208627cb6dd4ec59140ca6a13decc849a1ae7adf (patch) | |
tree | 3ea45bc1225348b78fa610640ae5d20bdd8343a7 | |
parent | 48e7ce254198fbada923a9cd315c44b0fa2f6b1f (diff) | |
parent | dfc059da55983a124a9b7fbb8daf44ad159b1112 (diff) | |
download | platform_system_apex-208627cb6dd4ec59140ca6a13decc849a1ae7adf.tar.gz platform_system_apex-208627cb6dd4ec59140ca6a13decc849a1ae7adf.tar.bz2 platform_system_apex-208627cb6dd4ec59140ca6a13decc849a1ae7adf.zip |
apex_file: fix a use of uninitialized memory am: dfc059da55
Original change: https://android-review.googlesource.com/c/platform/system/apex/+/1416210
Change-Id: Idf66ef4bfe1b40cbfe6ff8d29bcfe33b1ea2f643
-rw-r--r-- | apexd/apex_file.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/apexd/apex_file.cpp b/apexd/apex_file.cpp index abcda7df..0d7502b6 100644 --- a/apexd/apex_file.cpp +++ b/apexd/apex_file.cpp @@ -83,14 +83,15 @@ Result<ApexFile> ApexFile::Open(const std::string& path) { std::string manifest_content; std::string pubkey; - ZipArchiveHandle handle; - auto handle_guard = - android::base::make_scope_guard([&handle] { CloseArchive(handle); }); unique_fd fd(open(path.c_str(), O_RDONLY | O_BINARY | O_CLOEXEC)); if (fd < 0) { return Error() << "Failed to open package " << path << ": " << "I/O error"; } + + ZipArchiveHandle handle; + auto handle_guard = + android::base::make_scope_guard([&handle] { CloseArchive(handle); }); int ret = OpenArchiveFd(fd.get(), path.c_str(), &handle, false); if (ret < 0) { return Error() << "Failed to open package " << path << ": " |