diff options
Diffstat (limited to 'gpu/command_buffer/client/fenced_allocator.cc')
-rw-r--r-- | gpu/command_buffer/client/fenced_allocator.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gpu/command_buffer/client/fenced_allocator.cc b/gpu/command_buffer/client/fenced_allocator.cc index d262115..0d395c4 100644 --- a/gpu/command_buffer/client/fenced_allocator.cc +++ b/gpu/command_buffer/client/fenced_allocator.cc @@ -39,9 +39,11 @@ FencedAllocator::~FencedAllocator() { // optimizing what to wait for, just looks inside the block in order (first-fit // as well). FencedAllocator::Offset FencedAllocator::Alloc(unsigned int size) { - // Similarly to malloc, an allocation of 0 allocates at least 1 byte, to - // return different pointers every time. - if (size == 0) size = 1; + // size of 0 is not allowed because it would be inconsistent to only sometimes + // have it succeed. Example: Alloc(SizeOfBuffer), Alloc(0). + if (size == 0) { + return kInvalidOffset; + } // Try first to allocate in a free block. for (unsigned int i = 0; i < blocks_.size(); ++i) { |