Fix memory leak in OTA verifier code
StartIteration() allocates some memory, which are release in EndIteration(). Since we never called EndIteration(), these memories are leaked. Test: th Bug: 233209345 Change-Id: I71c1d6eec16b8ac20c35e180f34fec50d0baec1a
This commit is contained in:
parent
7c4d5accbf
commit
063bc24564
1 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue