Skip to content

Commit

Permalink
[vm] Check for OOM when allocating a new handle block.
Browse files Browse the repository at this point in the history
Bug: dart-lang/sdk#32706
Change-Id: I0159d794e11c18f24204d11d9ba3bbfe8a5a4140
Reviewed-on: https://dart-review.googlesource.com/48706
Reviewed-by: Siva Annamalai <[email protected]>
Reviewed-by: Alexander Aprelev <[email protected]>
Commit-Queue: Ryan Macnak <[email protected]>
  • Loading branch information
rmacnak-google authored and [email protected] committed Mar 28, 2018
1 parent 865f527 commit 3dcdaf9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions runtime/vm/handles_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ void Handles<kHandleSizeInWords, kHandlesPerChunk, kOffsetOfRawPtr>::
CountScopedHandles());
}
if (scoped_blocks_->next_block() == NULL) {
scoped_blocks_->set_next_block(new HandlesBlock(NULL));
HandlesBlock* block = new HandlesBlock(NULL);
if (block == NULL) {
OUT_OF_MEMORY();
}
scoped_blocks_->set_next_block(block);
}
scoped_blocks_ = scoped_blocks_->next_block();
scoped_blocks_->set_next_handle_slot(0);
Expand Down Expand Up @@ -203,7 +207,9 @@ void Handles<kHandleSizeInWords, kHandlesPerChunk, kOffsetOfRawPtr>::
CountScopedHandles());
}
zone_blocks_ = new HandlesBlock(zone_blocks_);
ASSERT(zone_blocks_ != NULL);
if (zone_blocks_ == NULL) {
OUT_OF_MEMORY();
}
}

#if defined(DEBUG)
Expand Down

0 comments on commit 3dcdaf9

Please sign in to comment.