Commit c662992d authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

ntdll: Create free block after updating the size in HEAP_ShrinkBlock.

parent 419e4730
......@@ -815,17 +815,17 @@ static void HEAP_MakeInUseBlockFree( SUBHEAP *subheap, ARENA_INUSE *pArena )
*/
static void HEAP_ShrinkBlock(SUBHEAP *subheap, ARENA_INUSE *pArena, SIZE_T size)
{
if ((pArena->size & ARENA_SIZE_MASK) >= size + HEAP_MIN_SHRINK_SIZE)
SIZE_T old_data_size = pArena->size & ARENA_SIZE_MASK;
if (old_data_size >= size + HEAP_MIN_SHRINK_SIZE)
{
HEAP_CreateFreeBlock( subheap, (char *)(pArena + 1) + size,
(pArena->size & ARENA_SIZE_MASK) - size );
/* assign size plus previous arena flags */
pArena->size = size | (pArena->size & ~ARENA_SIZE_MASK);
HEAP_CreateFreeBlock( subheap, (char *)(pArena + 1) + size, old_data_size - size );
}
else
{
/* Turn off PREV_FREE flag in next block */
char *pNext = (char *)(pArena + 1) + (pArena->size & ARENA_SIZE_MASK);
char *pNext = (char *)(pArena + 1) + old_data_size;
if (pNext < (char *)subheap->base + subheap->size)
*(DWORD *)pNext &= ~ARENA_FLAG_PREV_FREE;
}
......
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