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

Commit f9782789 authored by Tao Bao's avatar Tao Bao
Browse files

Fix the double free in verify_package_compatibility().

"""
void* cookie;
std::unique_ptr<void, decltype(&EndIteration)> guard(cookie, EndIteration);
  ...
EndIteration(cookie);
"""

The above pattern is buggy that frees 'cookie' twice.

Bug: 37413730
Test: Build new recovery and adb sideload a previously crashed package
      that contains 'compatibility.zip'.
Change-Id: I183c33827fb28a438ebaedda446e84cabe7cb92d
parent 25dbe171
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -544,7 +544,6 @@ bool verify_package_compatibility(ZipArchiveHandle package_zip) {
    }
    compatibility_info.emplace_back(std::move(content));
  }
  EndIteration(cookie);
  CloseArchive(zip_handle);

  // TODO(b/36814503): Enable the actual verification when VintfObject::CheckCompatibility() lands.