AAPT2: Fix order-of-destruction crash
Make sure that users of StringPool are destroyed before
the StringPool itself.
Test: valgrind aapt2 optimize -o opt.apk out/target/common/obj/APPS/framework-res_intermediates/package-export.apk
Change-Id: I140c2d32f8449028976795d5d6865d83e1409b53
diff --git a/tools/aapt2/cmd/Link.cpp b/tools/aapt2/cmd/Link.cpp
index 6e0809e..9fb087c 100644
--- a/tools/aapt2/cmd/Link.cpp
+++ b/tools/aapt2/cmd/Link.cpp
@@ -376,8 +376,8 @@
versioned_file_desc.config.sdkVersion = (uint16_t)sdk_level;
FileOperation new_file_op;
- new_file_op.xml_to_flatten =
- util::make_unique<xml::XmlResource>(versioned_file_desc, doc->root->Clone());
+ new_file_op.xml_to_flatten = util::make_unique<xml::XmlResource>(
+ versioned_file_desc, StringPool{}, doc->root->Clone());
new_file_op.config = versioned_file_desc.config;
new_file_op.entry = file_op->entry;
new_file_op.dst_path =