Jacek Caban : jscript: Mark free memory if heap warnings are turned on.

Alexandre Julliard julliard at winehq.org
Wed Feb 25 09:22:38 CST 2009


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Feb 25 01:29:32 2009 +0100

jscript: Mark free memory if heap warnings are turned on.

---

 dlls/jscript/jsutils.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c
index 5417daf..73bac94 100644
--- a/dlls/jscript/jsutils.c
+++ b/dlls/jscript/jsutils.c
@@ -27,6 +27,7 @@
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(jscript);
+WINE_DECLARE_DEBUG_CHANNEL(heap);
 
 const char *debugstr_variant(const VARIANT *v)
 {
@@ -51,6 +52,7 @@ const char *debugstr_variant(const VARIANT *v)
 }
 
 #define MIN_BLOCK_SIZE  128
+#define ARENA_FREE_FILLER  0xaa
 
 static inline DWORD block_size(DWORD block)
 {
@@ -139,6 +141,13 @@ void jsheap_clear(jsheap_t *heap)
         heap_free(tmp);
     }
 
+    if(WARN_ON(heap)) {
+        DWORD i;
+
+        for(i=0; i < heap->block_cnt; i++)
+            memset(heap->blocks[i], ARENA_FREE_FILLER, block_size(i));
+    }
+
     heap->last_block = heap->offset = 0;
     heap->mark = FALSE;
 }




More information about the wine-cvs mailing list