Resend of Update to heap.c

jeffl jeffl at defcen.gov.au
Wed Feb 11 02:54:36 CST 2004


When browsing ntdll/heap.c I noticed that the condition set would cause 
a memory leak if the unlikely event ever occured.  The patch causes a 
warning to be issued as well so that there is a record.

Jeff
-------------- next part --------------
Index: dlls/ntdll/heap.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/heap.c,v
retrieving revision 1.27
diff -u -r1.27 heap.c
--- dlls/ntdll/heap.c   25 Nov 2003 01:53:23 -0000      1.27
+++ dlls/ntdll/heap.c   11 Feb 2004 08:50:15 -0000
@@ -404,7 +404,12 @@
     /* If debugging, erase the freed block content */
  
     pEnd = (char *)ptr + size;
-    if (pEnd > (char *)subheap + subheap->commitSize) pEnd = (char *)subheap +
subheap->commitSize;
+    if (pEnd > (char *)subheap + subheap->commitSize)
+    {
+       WARN("Free arena %p, size %081x exceeds subheap %p commit size %081x",
+            ptr, size, subheap, subheap->commitSize);
+       pEnd = (char *)subheap + subheap->commitSize;
+    }
     if (pEnd > (char *)(pFree + 1)) mark_block_free( pFree + 1, pEnd - (char *)(pFree + 1) );
  



More information about the wine-patches mailing list