From: Rémi Bernon <rbernon(a)codeweavers.com> Block sizes are now always rounded to ALIGNMENT multiple, except for the last free block in a region. This makes it consistent and will let us use a more compact block layout. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/ntdll/heap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index cad644f2153..0d7feee189b 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -892,6 +892,7 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags, SIZE_T commitSize, SIZE_T totalSize ) { struct entry *pEntry; + SIZE_T block_size; SUBHEAP *subheap; unsigned int i; @@ -991,9 +992,9 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags, } } - /* Create the first free block */ - - create_free_block( subheap, first_block( subheap ), subheap_size( subheap ) - subheap_overhead( subheap ) ); + block_size = subheap_size( subheap ) - subheap_overhead( subheap ); + block_size &= ~(ALIGNMENT - 1); + create_free_block( subheap, first_block( subheap ), block_size ); return subheap; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/165