Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: runtime/vm/benchmark_test.cc

Issue 2620413002: Fix various memory leaks in unit tests detected by a new version of ASAN. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/compiler_test.cc » ('j') | runtime/vm/unit_test.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/benchmark_test.cc
diff --git a/runtime/vm/benchmark_test.cc b/runtime/vm/benchmark_test.cc
index db3bfc434ae1a661c27d28caddc5dc5ad07d1d0e..f93081cea94cbe544617596797ccf0d6918d3aed 100644
--- a/runtime/vm/benchmark_test.cc
+++ b/runtime/vm/benchmark_test.cc
@@ -96,7 +96,7 @@ void Benchmark::RunAll(const char* executable) {
Dart_Isolate Benchmark::CreateIsolate(const uint8_t* buffer) {
- bin::IsolateData* isolate_data = new bin::IsolateData(NULL, NULL, NULL);
+ bin::IsolateData* isolate_data = NULL;
char* err = NULL;
isolate_ = Dart_CreateIsolate(NULL, NULL, buffer, NULL, isolate_data, &err);
zra 2017/01/11 19:05:21 Any reason not to drop the variable and just pass
rmacnak 2017/01/11 19:11:08 Good point, done.
EXPECT(isolate_ != NULL);
@@ -520,6 +520,9 @@ BENCHMARK_SIZE(CoreSnapshotSize) {
const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer);
ASSERT(snapshot->kind() == Snapshot::kCore);
benchmark->set_score(snapshot->length());
+
+ free(vm_isolate_snapshot_buffer);
+ free(isolate_snapshot_buffer);
}
@@ -554,6 +557,9 @@ BENCHMARK_SIZE(StandaloneSnapshotSize) {
const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer);
ASSERT(snapshot->kind() == Snapshot::kCore);
benchmark->set_score(snapshot->length());
+
+ free(vm_isolate_snapshot_buffer);
+ free(isolate_snapshot_buffer);
}
« no previous file with comments | « no previous file | runtime/vm/compiler_test.cc » ('j') | runtime/vm/unit_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698