Fixed size check in HEAP_FindFreeBlock to make sure we also find
blocks that have the exact size needed.
This commit is contained in:
parent
c927fe848e
commit
abc3539768
@ -614,7 +614,9 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, DWORD size,
|
|||||||
pArena = pEntry->arena.next;
|
pArena = pEntry->arena.next;
|
||||||
while (pArena != &heap->freeList[0].arena)
|
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 );
|
subheap = HEAP_FindSubHeap( heap, pArena );
|
||||||
if (!HEAP_Commit( subheap, (char *)pArena + sizeof(ARENA_INUSE)
|
if (!HEAP_Commit( subheap, (char *)pArena + sizeof(ARENA_INUSE)
|
||||||
@ -623,7 +625,6 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, DWORD size,
|
|||||||
*ppSubHeap = subheap;
|
*ppSubHeap = subheap;
|
||||||
return pArena;
|
return pArena;
|
||||||
}
|
}
|
||||||
|
|
||||||
pArena = pArena->next;
|
pArena = pArena->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user