Merge "Fix memory leak in OTA verifier code" am: 65162cd9b0 am: efc4279944

Original change: https://android-review.googlesource.com/c/platform/bootable/recovery/+/2106828

Change-Id: I75f7925aaacd1fa51bfef443465bb264b66ded2d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2022-05-25 23:38:00 +00:00 committed by Automerger Merge Worker
commit 6e0b7fa5ec

View file

@ -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;