diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2022-05-26 00:38:57 +0200 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2022-05-26 00:38:57 +0200 |
commit | 65162cd9b0516fa6ddb94d7f58c619e704c8bcd7 (patch) | |
tree | c7e936bd0c97ea8f5d6ffb2fd4c8068e104b759c | |
parent | Merge "Log a copy of recovery log to kernel logs" (diff) | |
parent | Fix memory leak in OTA verifier code (diff) | |
download | android_bootable_recovery-65162cd9b0516fa6ddb94d7f58c619e704c8bcd7.tar android_bootable_recovery-65162cd9b0516fa6ddb94d7f58c619e704c8bcd7.tar.gz android_bootable_recovery-65162cd9b0516fa6ddb94d7f58c619e704c8bcd7.tar.bz2 android_bootable_recovery-65162cd9b0516fa6ddb94d7f58c619e704c8bcd7.tar.lz android_bootable_recovery-65162cd9b0516fa6ddb94d7f58c619e704c8bcd7.tar.xz android_bootable_recovery-65162cd9b0516fa6ddb94d7f58c619e704c8bcd7.tar.zst android_bootable_recovery-65162cd9b0516fa6ddb94d7f58c619e704c8bcd7.zip |
-rw-r--r-- | otautil/verifier.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/otautil/verifier.cpp b/otautil/verifier.cpp index 8a65566ec..83ad7082b 100644 --- a/otautil/verifier.cpp +++ b/otautil/verifier.cpp @@ -309,13 +309,15 @@ int verify_file(VerifierInterface* package, const std::vector<Certificate>& keys } static std::vector<Certificate> IterateZipEntriesAndSearchForKeys(const ZipArchiveHandle& handle) { - void* cookie; + void* cookie{}; + int32_t iter_status = StartIteration(handle, &cookie, "", "x509.pem"); if (iter_status != 0) { LOG(ERROR) << "Failed to iterate over entries in the certificate zipfile: " << ErrorCodeString(iter_status); return {}; } + std::unique_ptr<void, decltype(&EndIteration)> cookie_guard(cookie, &EndIteration); std::vector<Certificate> result; |