summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-05-26 04:38:08 +0200
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-05-26 04:38:08 +0200
commit0af756cd6f67fe1b615a3a65451069a730bdb0d2 (patch)
tree2a39005fa7ad5eb418101bbc935a699cafea182a
parent[automerger skipped] Import translations. DO NOT MERGE ANYWHERE am: fe7c99d955 -s ours am: bae0c14402 -s ours am: 02fab679cf -s ours (diff)
parentMerge "Fix memory leak in OTA verifier code" am: 65162cd9b0 am: efc4279944 am: 6e0b7fa5ec (diff)
downloadandroid_bootable_recovery-0af756cd6f67fe1b615a3a65451069a730bdb0d2.tar
android_bootable_recovery-0af756cd6f67fe1b615a3a65451069a730bdb0d2.tar.gz
android_bootable_recovery-0af756cd6f67fe1b615a3a65451069a730bdb0d2.tar.bz2
android_bootable_recovery-0af756cd6f67fe1b615a3a65451069a730bdb0d2.tar.lz
android_bootable_recovery-0af756cd6f67fe1b615a3a65451069a730bdb0d2.tar.xz
android_bootable_recovery-0af756cd6f67fe1b615a3a65451069a730bdb0d2.tar.zst
android_bootable_recovery-0af756cd6f67fe1b615a3a65451069a730bdb0d2.zip
-rw-r--r--otautil/verifier.cpp4
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;