Fix a leak in the verifier and a minor test bug.
Both found by a valgrind run on the host.
Change-Id: I247efbc8b354f1597648e999ad2a7835f2a43e05
diff --git a/src/dex_verifier.cc b/src/dex_verifier.cc
index 91dd4ea..6fd7c20 100644
--- a/src/dex_verifier.cc
+++ b/src/dex_verifier.cc
@@ -4040,8 +4040,14 @@
}
void DexVerifier::DeleteGcMaps() {
- MutexLock mu(*gc_maps_lock_);
- STLDeleteValues(gc_maps_);
+ {
+ MutexLock mu(*gc_maps_lock_);
+ STLDeleteValues(gc_maps_);
+ delete gc_maps_;
+ gc_maps_ = NULL;
+ }
+ delete gc_maps_lock_;
+ gc_maps_lock_ = NULL;
}
void DexVerifier::SetGcMap(Compiler::MethodReference ref, const std::vector<uint8_t>& gc_map) {
diff --git a/src/space_test.cc b/src/space_test.cc
index 16ffb08..37e5a8a 100644
--- a/src/space_test.cc
+++ b/src/space_test.cc
@@ -178,7 +178,7 @@
// Fill the space with lots of small objects up to the growth limit
size_t max_objects = (growth_limit / (object_size > 0 ? object_size : 8)) + 1;
- UniquePtr<Object*> lots_of_objects(new Object*[max_objects]);
+ UniquePtr<Object*[]> lots_of_objects(new Object*[max_objects]);
size_t last_object = 0; // last object for which allocation succeeded
size_t amount_allocated = 0; // amount of space allocated
for(size_t i = 0; i < max_objects; i++) {