twrpinstall: Remove unnecessary CloseArchive() calls

The destructor MemoryPackage::~MemoryPackage() will automatically call CloseArchive(), so there is no need to repeat the operation to prevent Recovery from crashing.

Change-Id: Ife5d5818bc603f8709e998b856a1e97bc365fc87
This commit is contained in:
sekaiacg
2021-12-04 20:01:46 +08:00
parent 82fba90680
commit cdc0319717
2 changed files with 0 additions and 8 deletions
-2
View File
@@ -66,7 +66,6 @@ bool read_metadata_from_package(ZipArchiveHandle zip, std::string* meta_data) {
size);
if (ret != 0) {
printf("Failed to read metadata in update package.\n");
CloseArchive(zip);
return false;
}
return true;
@@ -213,7 +212,6 @@ abupdate_binary_command(const char* path, int retry_count __unused,
binary_entry.uncompressed_length);
if (extract_ret != 0) {
printf("Can't extract %s\n", AB_OTA_PAYLOAD_PROPERTIES);
CloseArchive(Zip);
return false;
}
-6
View File
@@ -71,13 +71,11 @@ enum zip_type {
static int Install_Theme(const char* path, ZipArchiveHandle Zip) {
#ifdef TW_OEM_BUILD // We don't do custom themes in OEM builds
CloseArchive(Zip);
return INSTALL_CORRUPT;
#else
std::string binary_name("ui.xml");
ZipEntry binary_entry;
if (FindEntry(Zip, binary_name, &binary_entry) != 0) {
CloseArchive(Zip);
return INSTALL_CORRUPT;
}
if (!PartitionManager.Mount_Settings_Storage(true))
@@ -129,7 +127,6 @@ static int Prepare_Update_Binary(ZipArchiveHandle Zip) {
}
int32_t err = ExtractEntryToFile(Zip, &binary_entry, fd);
if (err != 0) {
CloseArchive(Zip);
LOGERR("Could not extract '%s'\n", UPDATE_BINARY_NAME);
return INSTALL_ERROR;
}
@@ -148,7 +145,6 @@ static int Prepare_Update_Binary(ZipArchiveHandle Zip) {
return INSTALL_ERROR;
}
if (ExtractEntryToFile(Zip, &file_contexts_entry, fd)) {
CloseArchive(Zip);
LOGERR("Could not extract '%s'\n", output_filename.c_str());
return INSTALL_ERROR;
}
@@ -319,7 +315,6 @@ int TWinstall_zip(const char* path, int* wipe_cache, bool check_for_digest) {
// Additionally verify the compatibility of the package.
if (!verify_package_compatibility(Zip)) {
gui_err("zip_compatible_err=Zip Treble compatibility error!");
CloseArchive(Zip);
ret_val = INSTALL_CORRUPT;
} else {
ret_val = Prepare_Update_Binary(Zip);
@@ -363,7 +358,6 @@ int TWinstall_zip(const char* path, int* wipe_cache, bool check_for_digest) {
LOGINFO("TWRP theme zip\n");
ret_val = Install_Theme(path, Zip);
} else {
CloseArchive(Zip);
ret_val = INSTALL_CORRUPT;
}
}