1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Fix for PR2578. Do not split off a block whose size is less than FreeRangeHeader::getMinBlockSize(). Patch by Damien.

llvm-svn: 54152
This commit is contained in:
Evan Cheng 2008-07-29 07:38:32 +00:00
parent ebe629a4b2
commit 10d4254f45

View File

@ -202,6 +202,9 @@ TrimAllocationToSize(FreeRangeHeader *FreeList, uint64_t NewSize) {
assert(ThisAllocated && getBlockAfter().PrevAllocated &&
"Cannot deallocate part of an allocated block!");
// Don't allow blocks to be trimmed below minimum required size
NewSize = std::max<uint64_t>(FreeRangeHeader::getMinBlockSize(), NewSize);
// Round up size for alignment of header.
unsigned HeaderAlign = __alignof(FreeRangeHeader);
NewSize = (NewSize+ (HeaderAlign-1)) & ~(HeaderAlign-1);