Remove an unsafe memory write in HeapFree
authorJohn Chen <jochen@microsoft.com>
Fri, 13 Nov 2015 21:49:43 +0000 (13:49 -0800)
committerJohn Chen <jochen@microsoft.com>
Fri, 13 Nov 2015 21:49:43 +0000 (13:49 -0800)
The PAL implementation of HeapFree assumes that the memory region always
have at least 4 bytes. Depending on the heap implementation, this is not
necessarily true, and can potentially cause memory corruption.

src/pal/src/memory/heap.cpp

index ff1f2a2..732fe9a 100644 (file)
@@ -309,8 +309,6 @@ HeapFree(
         goto done;
     }
 
-    *((DWORD *) lpMem) = 0;
-
     bRetVal = TRUE;
 #ifdef __APPLE__
     // This is patterned off of InternalFree in malloc.cpp.