ART: Fix two allocation/deallocation mismatches.
Change-Id: I5088126cbd5b5e4b461a449eecd5b3574883f413
diff --git a/runtime/dex_file_verifier_test.cc b/runtime/dex_file_verifier_test.cc
index 1b529c9..272249c 100644
--- a/runtime/dex_file_verifier_test.cc
+++ b/runtime/dex_file_verifier_test.cc
@@ -117,7 +117,7 @@
struct DexFileDeleter {
void operator()(DexFile* in) {
if (in != nullptr) {
- delete in->Begin();
+ delete[] in->Begin();
delete in;
}
}
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index a23d94d..a4a159e 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -224,18 +224,20 @@
UNUSED(error_msg);
return false;
#else
- std::unique_ptr<char> absolute_path(realpath(elf_filename.c_str(), nullptr));
- if (absolute_path == nullptr) {
- *error_msg = StringPrintf("Failed to find absolute path for '%s'", elf_filename.c_str());
- return false;
- }
+ {
+ UniqueCPtr<char> absolute_path(realpath(elf_filename.c_str(), nullptr));
+ if (absolute_path == nullptr) {
+ *error_msg = StringPrintf("Failed to find absolute path for '%s'", elf_filename.c_str());
+ return false;
+ }
#ifdef __ANDROID__
- android_dlextinfo extinfo;
- extinfo.flags = ANDROID_DLEXT_FORCE_LOAD | ANDROID_DLEXT_FORCE_FIXED_VADDR;
- dlopen_handle_ = android_dlopen_ext(absolute_path.get(), RTLD_NOW, &extinfo);
+ android_dlextinfo extinfo;
+ extinfo.flags = ANDROID_DLEXT_FORCE_LOAD | ANDROID_DLEXT_FORCE_FIXED_VADDR;
+ dlopen_handle_ = android_dlopen_ext(absolute_path.get(), RTLD_NOW, &extinfo);
#else
- dlopen_handle_ = dlopen(absolute_path.get(), RTLD_NOW);
+ dlopen_handle_ = dlopen(absolute_path.get(), RTLD_NOW);
#endif
+ }
if (dlopen_handle_ == nullptr) {
*error_msg = StringPrintf("Failed to dlopen '%s': %s", elf_filename.c_str(), dlerror());
return false;