Switch CreateMethodDescriptor over to std::string to avoid memory leaks.
Change-Id: I17005504ab7d055e0750cf35ab2426e0f798f895
diff --git a/src/dex_file_test.cc b/src/dex_file_test.cc
index 9eb5f73..37c601c 100644
--- a/src/dex_file_test.cc
+++ b/src/dex_file_test.cc
@@ -79,9 +79,8 @@
const char* name = raw->dexStringById(method_id.name_idx_);
ASSERT_STREQ("<init>", name);
int32_t length;
- scoped_array<const char> descriptor(raw->CreateMethodDescriptor(proto_idx,
- &length));
- ASSERT_STREQ("()V", descriptor.get());
+ std::string descriptor(raw->CreateMethodDescriptor(proto_idx, &length));
+ ASSERT_EQ("()V", descriptor);
}
// Check both virtual methods.
@@ -98,9 +97,8 @@
uint32_t proto_idx = method_id.proto_idx_;
int32_t length;
- scoped_array<const char> descriptor(raw->CreateMethodDescriptor(proto_idx,
- &length));
- ASSERT_STREQ("(IDJLjava/lang/Object;)Ljava/lang/Float;", descriptor.get());
+ std::string descriptor(raw->CreateMethodDescriptor(proto_idx, &length));
+ ASSERT_EQ("(IDJLjava/lang/Object;)Ljava/lang/Float;", descriptor);
}
{
@@ -113,9 +111,8 @@
uint32_t proto_idx = method_id.proto_idx_;
int32_t length;
- scoped_array<const char> descriptor(raw->CreateMethodDescriptor(proto_idx,
- &length));
- ASSERT_STREQ("(ZSC)LCreateMethodDescriptor;", descriptor.get());
+ std::string descriptor(raw->CreateMethodDescriptor(proto_idx, &length));
+ ASSERT_EQ("(ZSC)LCreateMethodDescriptor;", descriptor);
}
}