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

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

Change-Id: I62c95f4549322185a71ffbca79041a6346abd16d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2022-05-26 02:12:20 +00:00 committed by Automerger Merge Worker
commit 1ec805514b

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;