Commit 7399dfa9 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

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

parent ed78892e
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(jscript); WINE_DEFAULT_DEBUG_CHANNEL(jscript);
WINE_DECLARE_DEBUG_CHANNEL(heap);
const char *debugstr_variant(const VARIANT *v) const char *debugstr_variant(const VARIANT *v)
{ {
...@@ -51,6 +52,7 @@ const char *debugstr_variant(const VARIANT *v) ...@@ -51,6 +52,7 @@ const char *debugstr_variant(const VARIANT *v)
} }
#define MIN_BLOCK_SIZE 128 #define MIN_BLOCK_SIZE 128
#define ARENA_FREE_FILLER 0xaa
static inline DWORD block_size(DWORD block) static inline DWORD block_size(DWORD block)
{ {
...@@ -139,6 +141,13 @@ void jsheap_clear(jsheap_t *heap) ...@@ -139,6 +141,13 @@ void jsheap_clear(jsheap_t *heap)
heap_free(tmp); 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->last_block = heap->offset = 0;
heap->mark = FALSE; heap->mark = FALSE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment