Fix mismatched malloc/free delete/new.
Modify the monitor code to override the delete operator. The problem
is the new operator is overloaded to return a pointer returned by
posix_memalign, but then it's freed with a delete, not a free call.
Also, fix the debugger code to use the [] for a std::unique_ptr to
match how the value is actually allocated.
Both problems found by ASAN.
Bug: 18202869
Change-Id: I2f3a2c02a7f35399b7ba6717b08a035089fab00d
diff --git a/runtime/monitor.h b/runtime/monitor.h
index 95e4460..b7245c1 100644
--- a/runtime/monitor.h
+++ b/runtime/monitor.h
@@ -141,6 +141,10 @@
CHECK_EQ(error, 0) << strerror(error);
return result;
}
+
+ void operator delete(void* ptr) {
+ free(ptr);
+ }
#endif
private: