Obeying request to zero.

This commit is contained in:
Ben Vanik 2013-10-27 12:47:00 -07:00
parent 6477d6c21e
commit 11f99ce33b
2 changed files with 3 additions and 2 deletions

View File

@ -77,7 +77,7 @@ X_STATUS xeNtAllocateVirtualMemory(
} }
// Allocate. // Allocate.
uint32_t flags = 0; uint32_t flags = (allocation_type & X_MEM_NOZERO);
uint32_t addr = xe_memory_heap_alloc( uint32_t addr = xe_memory_heap_alloc(
state->memory(), *base_addr_ptr, adjusted_size, flags); state->memory(), *base_addr_ptr, adjusted_size, flags);
if (!addr) { if (!addr) {

View File

@ -527,7 +527,8 @@ uint32_t xe_memory_heap_t::Alloc(
PAGE_READWRITE); PAGE_READWRITE);
} }
if (FLAGS_scribble_heap) { if ((flags & X_MEM_NOZERO) &&
FLAGS_scribble_heap) {
// Trash the memory so that we can see bad read-before-write bugs easier. // Trash the memory so that we can see bad read-before-write bugs easier.
memset(p, 0xCD, alloc_size); memset(p, 0xCD, alloc_size);
} }