diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc index a8c1e612d..12c67346d 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc @@ -77,7 +77,7 @@ X_STATUS xeNtAllocateVirtualMemory( } // Allocate. - uint32_t flags = 0; + uint32_t flags = (allocation_type & X_MEM_NOZERO); uint32_t addr = xe_memory_heap_alloc( state->memory(), *base_addr_ptr, adjusted_size, flags); if (!addr) { diff --git a/src/xenia/memory.cc b/src/xenia/memory.cc index 73de43739..a4308997e 100644 --- a/src/xenia/memory.cc +++ b/src/xenia/memory.cc @@ -527,7 +527,8 @@ uint32_t xe_memory_heap_t::Alloc( 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. memset(p, 0xCD, alloc_size); }