Fix memory leak in test util

This shows up when you're doing make HOST_SANITIZE=address

Test: mmma bionic && out/host/linux-x86/bin/bionic_tests_zipalign (compare before and after)
Change-Id: Ia94790496327f3818d5fdb7b5ad07e14e60bcae1
diff --git a/tests/libs/bionic_tests_zipalign.cpp b/tests/libs/bionic_tests_zipalign.cpp
index a72820f..8e31474 100644
--- a/tests/libs/bionic_tests_zipalign.cpp
+++ b/tests/libs/bionic_tests_zipalign.cpp
@@ -19,6 +19,7 @@
 #include <stdlib.h>
 
 #include <algorithm>
+#include <memory>
 #include <string>
 #include <vector>
 
@@ -36,7 +37,7 @@
   fprintf(stderr, "    The output zip file that will be created from the input file.\n");
 }
 
-typedef std::pair<ZipEntry*, ZipString*> ZipData;
+using ZipData = std::pair<std::unique_ptr<ZipEntry>, std::unique_ptr<ZipString>>;
 
 static bool GetEntries(ZipArchiveHandle handle, std::vector<ZipData>* entries) {
   void* cookie;
@@ -49,14 +50,15 @@
   ZipEntry entry;
   ZipString name;
   while ((return_value = Next(cookie, &entry, &name)) == 0) {
-    entries->push_back(std::make_pair(new ZipEntry(entry), new ZipString(name)));
+    entries->emplace_back(std::make_pair(std::make_unique<ZipEntry>(entry),
+                                         std::make_unique<ZipString>(name)));
   }
   if (return_value != -1) {
     fprintf(stderr, "Error while iterating over zip entries: %s\n", ErrorCodeString(return_value));
   } else {
     // Sort by offset.
     std::sort(entries->begin(), entries->end(),
-              [](ZipData a, ZipData b) { return a.first->offset < b.first->offset; });
+              [](ZipData& a, ZipData& b) { return a.first->offset < b.first->offset; });
   }
 
   EndIteration(cookie);
@@ -75,8 +77,8 @@
 
   int32_t error;
   for (auto& entry : entries) {
-    ZipEntry* zip_entry = entry.first;
-    ZipString* zip_str = entry.second;
+    ZipEntry* zip_entry = entry.first.get();
+    ZipString* zip_str = entry.second.get();
 
     size_t flags = 0;
     if ((zip_entry->method & kCompressDeflated) != 0) {