Fix memory leak on APK extension install

This commit is contained in:
Syer10
2026-07-13 13:24:27 -04:00
parent c84ab6e426
commit 2051c6d51d

View File

@@ -95,7 +95,7 @@ object PackageTools {
/** A modified version of `xyz.nulldev.androidcompat.pm.InstalledPackage.info` */
fun getPackageInfo(apkFile: Path): PackageInfo =
ApkParsers.getMetaInfo(apkFile.toFile()).toPackageInfo(apkFile.toFile()).apply {
val parsed = ApkFile(apkFile.toFile())
ApkFile(apkFile.toFile()).use { parsed ->
val dbFactory = DocumentBuilderFactory.newInstance()
val dBuilder = dbFactory.newDocumentBuilder()
val doc =
@@ -136,6 +136,7 @@ object PackageTools {
.map { Signature(it.data) }
.toTypedArray()
}
}
fun getSignatureHash(pkgInfo: PackageInfo): String? {
val signatures = pkgInfo.signatures