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

Unified Diff: runtime/vm/service.cc

Issue 2418323002: Make fatal out of memory messages uniform. (Closed)
Patch Set: macro Created 4 years, 2 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 | « runtime/vm/scavenger.cc ('k') | runtime/vm/zone.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index abd4271746543e867143265e5b5a6dfb7bb4e358..c01256e9ffa0cc2d4d05be54cbba0b9cf13c6f04 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -222,6 +222,9 @@ RawObject* Service::RequestAssets() {
static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
+ if (new_ptr == NULL) {
+ OUT_OF_MEMORY();
+ }
return reinterpret_cast<uint8_t*>(new_ptr);
}
@@ -1038,6 +1041,9 @@ void Service::SendEventWithData(const char* stream_id,
const intptr_t total_bytes = sizeof(uint64_t) + metadata_size + data_size;
uint8_t* message = static_cast<uint8_t*>(malloc(total_bytes));
+ if (message == NULL) {
+ OUT_OF_MEMORY();
+ }
intptr_t offset = 0;
// Metadata size.
« no previous file with comments | « runtime/vm/scavenger.cc ('k') | runtime/vm/zone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698