Skip to content

Commit

Permalink
Fall back to heap allocation in courgette alloc.
Browse files Browse the repository at this point in the history
BUG=704783

Review-Url: https://codereview.chromium.org/2775893002
Cr-Commit-Position: refs/heads/master@{#459554}
  • Loading branch information
waffles authored and Commit bot committed Mar 24, 2017
1 parent f2296e4 commit e5d0b0e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions courgette/memory_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ class MemoryAllocator {
}
}
}
// If the above fails (e.g. because we are in a sandbox), just try the heap.
if (!mem && base::UncheckedMalloc(bytes, reinterpret_cast<void**>(&mem))) {
mem[0] = static_cast<uint8_t>(HEAP_ALLOCATION);
}
return mem ? reinterpret_cast<pointer>(mem + sizeof(T)) : NULL;
}

Expand Down

0 comments on commit e5d0b0e

Please sign in to comment.