Maarten Lankhorst : ntdll: Give earlier notify to valgrind that HeapFree is trying to free some memory .

Alexandre Julliard julliard at winehq.org
Thu May 22 06:27:28 CDT 2008


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

Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date:   Wed May 21 15:29:31 2008 -0700

ntdll: Give earlier notify to valgrind that HeapFree is trying to free some memory.

---

 dlls/ntdll/heap.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index 3cd59f7..2b87e10 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -1280,8 +1280,10 @@ BOOLEAN WINAPI RtlFreeHeap( HANDLE heap, ULONG flags, PVOID ptr )
     flags |= heapPtr->flags;
     if (!(flags & HEAP_NO_SERIALIZE)) RtlEnterCriticalSection( &heapPtr->critSection );
 
-    /* Some sanity checks */
+    /* Inform valgrind we are trying to free memory, so it can throw up an error message */
+    notify_free( ptr );
 
+    /* Some sanity checks */
     pInUse  = (ARENA_INUSE *)ptr - 1;
     if (!(subheap = HEAP_FindSubHeap( heapPtr, pInUse ))) goto error;
     if ((char *)pInUse < (char *)subheap->base + subheap->headerSize) goto error;
@@ -1289,8 +1291,6 @@ BOOLEAN WINAPI RtlFreeHeap( HANDLE heap, ULONG flags, PVOID ptr )
 
     /* Turn the block into a free block */
 
-    notify_free( ptr );
-
     HEAP_MakeInUseBlockFree( subheap, pInUse );
 
     if (!(flags & HEAP_NO_SERIALIZE)) RtlLeaveCriticalSection( &heapPtr->critSection );




More information about the wine-cvs mailing list