Fix the handful of leaks detectable in our tests.
Change-Id: I74ad1a3831fbebad60ff24f0b3ac07cade823b7a
diff --git a/src/dex_file_test.cc b/src/dex_file_test.cc
index 4b311dc..3cbef15 100644
--- a/src/dex_file_test.cc
+++ b/src/dex_file_test.cc
@@ -10,8 +10,8 @@
class DexFileTest : public CommonTest {};
TEST_F(DexFileTest, Open) {
- UniquePtr<const DexFile> dex(OpenTestDexFile("Nested"));
- ASSERT_TRUE(dex.get() != NULL);
+ const DexFile* dex(OpenTestDexFile("Nested"));
+ ASSERT_TRUE(dex != NULL);
}
// Although this is the same content logically as the Nested test dex,
@@ -70,8 +70,8 @@
}
TEST_F(DexFileTest, ClassDefs) {
- UniquePtr<const DexFile> raw(OpenTestDexFile("Nested"));
- ASSERT_TRUE(raw.get() != NULL);
+ const DexFile* raw(OpenTestDexFile("Nested"));
+ ASSERT_TRUE(raw != NULL);
EXPECT_EQ(2U, raw->NumClassDefs());
const DexFile::ClassDef& c0 = raw->GetClassDef(0);
@@ -82,8 +82,8 @@
}
TEST_F(DexFileTest, CreateMethodSignature) {
- UniquePtr<const DexFile> raw(OpenTestDexFile("CreateMethodSignature"));
- ASSERT_TRUE(raw.get() != NULL);
+ const DexFile* raw(OpenTestDexFile("CreateMethodSignature"));
+ ASSERT_TRUE(raw != NULL);
EXPECT_EQ(1U, raw->NumClassDefs());
const DexFile::ClassDef& class_def = raw->GetClassDef(0);
@@ -91,7 +91,7 @@
const byte* class_data = raw->GetClassData(class_def);
ASSERT_TRUE(class_data != NULL);
- ClassDataItemIterator it(*raw.get(), class_data);
+ ClassDataItemIterator it(*raw, class_data);
EXPECT_EQ(1u, it.NumDirectMethods());
@@ -137,8 +137,8 @@
}
TEST_F(DexFileTest, FindStringId) {
- UniquePtr<const DexFile> raw(OpenTestDexFile("CreateMethodSignature"));
- ASSERT_TRUE(raw.get() != NULL);
+ const DexFile* raw(OpenTestDexFile("CreateMethodSignature"));
+ ASSERT_TRUE(raw != NULL);
EXPECT_EQ(1U, raw->NumClassDefs());
const char* strings[] = { "LCreateMethodSignature;", "Ljava/lang/Float;", "Ljava/lang/Object;",