Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 65162cd9 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix memory leak in OTA verifier code"

parents 7c4d5acc 063bc245
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;