Rémi Bernon : ntdll: Use block size helpers in heap_reallocate.

Alexandre Julliard julliard at winehq.org
Thu May 19 16:15:12 CDT 2022


Module: wine
Branch: master
Commit: 61bc8abd1fa26861c43ed59097bb014a6ffd383c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=61bc8abd1fa26861c43ed59097bb014a6ffd383c

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Tue May  3 17:27:25 2022 +0200

ntdll: Use block size helpers in heap_reallocate.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/heap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index e3bfc3d37e7..6e64d0d7dfb 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -1662,8 +1662,8 @@ static NTSTATUS heap_reallocate( HEAP *heap, ULONG flags, void *ptr, SIZE_T size
 
     /* Check if we need to grow the block */
 
-    old_data_size = (block->size & ARENA_SIZE_MASK);
-    old_size = (block->size & ARENA_SIZE_MASK) - block->unused_bytes;
+    old_data_size = block_get_size( block ) - sizeof(*block);
+    old_size = block_get_size( block ) - block_get_overhead( block );
     if (data_size > old_data_size)
     {
         if ((next = next_block( subheap, block )) && (block_get_flags( next ) & ARENA_FLAG_FREE) &&




More information about the wine-cvs mailing list