Fixed size check in HEAP_FindFreeBlock to make sure we also find

blocks that have the exact size needed.
This commit is contained in:
Alexandre Julliard 2001-09-26 23:11:21 +00:00
parent c927fe848e
commit abc3539768

View File

@ -614,7 +614,9 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, DWORD size,
pArena = pEntry->arena.next;
while (pArena != &heap->freeList[0].arena)
{
if (pArena->size > size)
DWORD arena_size = (pArena->size & ARENA_SIZE_MASK) +
sizeof(ARENA_FREE) - sizeof(ARENA_INUSE);
if (arena_size >= size)
{
subheap = HEAP_FindSubHeap( heap, pArena );
if (!HEAP_Commit( subheap, (char *)pArena + sizeof(ARENA_INUSE)
@ -623,7 +625,6 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, DWORD size,
*ppSubHeap = subheap;
return pArena;
}
pArena = pArena->next;
}