diff options
author | Vladimir Marko <vmarko@google.com> | 2019-03-06 11:21:11 +0000 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2019-03-06 14:46:36 +0000 |
commit | 4b2d1c56cfd540e477a297abb70a18b72ef1ebfc (patch) | |
tree | 496ac062658644e3efa90fbde37acdb34032e1d8 /compiler/common_compiler_test.cc | |
parent | bf5f0f3f1eea2e712e7269ff1e1f9b1bcc4cbaee (diff) |
Fix memory leak in CommonCompilerTest::CompileMethod().
And enforce that we successfully compile the method.
This fixes ASAN tests broken by
https://android-review.googlesource.com/919053
Test: run_build_test_target.py art-gtest-heap-poisoning
Change-Id: I98b6c11e097bd9aea6605f3b77b1bcbb2206dbd0
Diffstat (limited to 'compiler/common_compiler_test.cc')
-rw-r--r-- | compiler/common_compiler_test.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc index d59cb17909..a44b9ae523 100644 --- a/compiler/common_compiler_test.cc +++ b/compiler/common_compiler_test.cc @@ -173,7 +173,7 @@ void CommonCompilerTest::CompileMethod(ArtMethod* method) { TimingLogger timings("CommonCompilerTest::CompileMethod", false, false); TimingLogger::ScopedTiming t(__FUNCTION__, &timings); CompiledMethodStorage storage(/*swap_fd=*/ -1); - const CompiledMethod* compiled_method = nullptr; + CompiledMethod* compiled_method = nullptr; { DCHECK(!Runtime::Current()->IsStarted()); Thread* self = Thread::Current(); @@ -204,8 +204,12 @@ void CommonCompilerTest::CompileMethod(ArtMethod* method) { } compiler_options_->verification_results_ = nullptr; } - TimingLogger::ScopedTiming t2("MakeExecutable", &timings); - MakeExecutable(method, compiled_method); + CHECK(method != nullptr); + { + TimingLogger::ScopedTiming t2("MakeExecutable", &timings); + MakeExecutable(method, compiled_method); + } + CompiledMethod::ReleaseSwapAllocatedCompiledMethod(&storage, compiled_method); } void CommonCompilerTest::CompileDirectMethod(Handle<mirror::ClassLoader> class_loader, |