Index: runtime/vm/code_observers.cc |
=================================================================== |
--- runtime/vm/code_observers.cc (revision 23633) |
+++ runtime/vm/code_observers.cc (working copy) |
@@ -4,6 +4,7 @@ |
#include "vm/code_observers.h" |
+#include "platform/utils.h" |
#include "vm/os.h" |
namespace dart { |
@@ -13,12 +14,12 @@ |
void CodeObservers::Register(CodeObserver* observer) { |
- observers_length_++; |
- observers_ = reinterpret_cast<CodeObserver**>( |
- realloc(observers_, sizeof(observer) * observers_length_)); |
+ intptr_t new_length = observers_length_ + 1; |
+ observers_ = Utils::Realloc(observers_, observers_length_, new_length); |
if (observers_ == NULL) { |
FATAL("failed to grow code observers array"); |
} |
+ observers_length_ = new_length; |
observers_[observers_length_ - 1] = observer; |
} |