summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-05-26 01:09:27 +0200
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-05-26 01:09:27 +0200
commitefc42799447d85dc62afa8dbc564ae200f50dbaa (patch)
tree05a7aea000a220c529d1cb31bfb34583a58adc2d
parentMerge "Log a copy of recovery log to kernel logs" am: 7c4d5accbf (diff)
parentMerge "Fix memory leak in OTA verifier code" (diff)
downloadandroid_bootable_recovery-efc42799447d85dc62afa8dbc564ae200f50dbaa.tar
android_bootable_recovery-efc42799447d85dc62afa8dbc564ae200f50dbaa.tar.gz
android_bootable_recovery-efc42799447d85dc62afa8dbc564ae200f50dbaa.tar.bz2
android_bootable_recovery-efc42799447d85dc62afa8dbc564ae200f50dbaa.tar.lz
android_bootable_recovery-efc42799447d85dc62afa8dbc564ae200f50dbaa.tar.xz
android_bootable_recovery-efc42799447d85dc62afa8dbc564ae200f50dbaa.tar.zst
android_bootable_recovery-efc42799447d85dc62afa8dbc564ae200f50dbaa.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;