summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-05-26 04:12:20 +0200
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-05-26 04:12:20 +0200
commit1ec805514b1a0759e54d2b70433ddf8a427d0eb6 (patch)
tree2a39005fa7ad5eb418101bbc935a699cafea182a
parent[automerger skipped] Import translations. DO NOT MERGE ANYWHERE am: fe7c99d955 -s ours am: bae0c14402 -s ours (diff)
parentMerge "Fix memory leak in OTA verifier code" am: 65162cd9b0 am: efc4279944 (diff)
downloadandroid_bootable_recovery-1ec805514b1a0759e54d2b70433ddf8a427d0eb6.tar
android_bootable_recovery-1ec805514b1a0759e54d2b70433ddf8a427d0eb6.tar.gz
android_bootable_recovery-1ec805514b1a0759e54d2b70433ddf8a427d0eb6.tar.bz2
android_bootable_recovery-1ec805514b1a0759e54d2b70433ddf8a427d0eb6.tar.lz
android_bootable_recovery-1ec805514b1a0759e54d2b70433ddf8a427d0eb6.tar.xz
android_bootable_recovery-1ec805514b1a0759e54d2b70433ddf8a427d0eb6.tar.zst
android_bootable_recovery-1ec805514b1a0759e54d2b70433ddf8a427d0eb6.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;