Alexandre Julliard : ntdll: Store the pending free list in the main process heap.

Alexandre Julliard julliard at winehq.org
Tue Apr 28 16:32:21 CDT 2020


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Apr 28 11:28:43 2020 +0200

ntdll: Store the pending free list in the main process heap.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

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

diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index af2a489b72..6bdbd89f8c 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -1508,14 +1508,9 @@ void heap_set_debug_flags( HANDLE handle )
     if ((heap->flags & HEAP_GROWABLE) && !heap->pending_free &&
         ((flags & HEAP_FREE_CHECKING_ENABLED) || RUNNING_ON_VALGRIND))
     {
-        void *ptr = NULL;
-        SIZE_T size = MAX_FREE_PENDING * sizeof(*heap->pending_free);
-
-        if (!virtual_alloc_aligned( &ptr, 0, &size, MEM_COMMIT, PAGE_READWRITE, 4 ))
-        {
-            heap->pending_free = ptr;
-            heap->pending_pos = 0;
-        }
+        heap->pending_free = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY,
+                                              MAX_FREE_PENDING * sizeof(*heap->pending_free) );
+        heap->pending_pos = 0;
     }
 }
 
@@ -1622,12 +1617,7 @@ HANDLE WINAPI RtlDestroyHeap( HANDLE heap )
         NtFreeVirtualMemory( NtCurrentProcess(), &addr, &size, MEM_RELEASE );
     }
     subheap_notify_free_all(&heapPtr->subheap);
-    if (heapPtr->pending_free)
-    {
-        size = 0;
-        addr = heapPtr->pending_free;
-        NtFreeVirtualMemory( NtCurrentProcess(), &addr, &size, MEM_RELEASE );
-    }
+    RtlFreeHeap( GetProcessHeap(), 0, heapPtr->pending_free );
     size = 0;
     addr = heapPtr->subheap.base;
     NtFreeVirtualMemory( NtCurrentProcess(), &addr, &size, MEM_RELEASE );




More information about the wine-cvs mailing list