Fix class_linker_test for valgrind.
Fix a memory leak.
Bug: 27156726
Change-Id: I4d9a2dc9cff447b6f2fd02432e018ae49766563a
diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc
index 4d528ed..5c3029a 100644
--- a/runtime/class_linker_test.cc
+++ b/runtime/class_linker_test.cc
@@ -1225,12 +1225,12 @@
dex_cache->SetLocation(location.Get());
const DexFile* old_dex_file = dex_cache->GetDexFile();
- DexFile* dex_file = new DexFile(old_dex_file->Begin(),
- old_dex_file->Size(),
- location->ToModifiedUtf8(),
- 0u,
- nullptr,
- nullptr);
+ std::unique_ptr<DexFile> dex_file(new DexFile(old_dex_file->Begin(),
+ old_dex_file->Size(),
+ location->ToModifiedUtf8(),
+ 0u,
+ nullptr,
+ nullptr));
{
WriterMutexLock mu(soa.Self(), *class_linker->DexLock());
// Check that inserting with a UTF16 name works.