Commit abc35397 authored by Alexandre Julliard's avatar Alexandre Julliard

Fixed size check in HEAP_FindFreeBlock to make sure we also find

blocks that have the exact size needed.
parent c927fe84
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment