Don't initialize host memory allocations in MSan builds

This allows detecting more potential uses of uninitialized memory in
MemorySanitizer (MSan) builds.

SwiftShader's internal uses of memory allocated by sw::allocate() should
be MSan error free at this point (explicitly initialized where needed),
and this change helps catch regressions.

Non-MSan builds are unaffected by this change, so that any errors that
are found in the near term don't pose a security risk. A subsequent
change will remove initialization for non-MSan builds as well.

Bug: b/140991626
Change-Id: I7843e4a4b806dc9108ac100706806c15bcea4ca9
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/57889
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Device/Renderer.cpp b/src/Device/Renderer.cpp
index 02812fa..6b632ed 100644
--- a/src/Device/Renderer.cpp
+++ b/src/Device/Renderer.cpp
@@ -146,9 +146,8 @@
 
 DrawCall::DrawCall()
 {
-	// TODO(b/140991626): Use allocateZeroOrPoison() instead of allocateZero() to detect MemorySanitizer errors.
 	// TODO(b/140991626): Use allocateUninitialized() instead of allocateZeroOrPoison() to improve startup peformance.
-	data = (DrawData *)sw::allocateZero(sizeof(DrawData));
+	data = (DrawData *)sw::allocateZeroOrPoison(sizeof(DrawData));
 	data->constants = &Constants::Get();
 }
 
diff --git a/src/Vulkan/VkMemory.cpp b/src/Vulkan/VkMemory.cpp
index 74de72c..33ee59e 100644
--- a/src/Vulkan/VkMemory.cpp
+++ b/src/Vulkan/VkMemory.cpp
@@ -33,10 +33,9 @@
 
 void *allocateHostMemory(size_t bytes, size_t alignment, const VkAllocationCallbacks *pAllocator, VkSystemAllocationScope allocationScope)
 {
-	// TODO(b/140991626): Use allocateZeroOrPoison() instead of allocateZero() to detect MemorySanitizer errors.
 	// TODO(b/140991626): Use allocateUninitialized() instead of allocateZeroOrPoison() to improve startup peformance.
 	return pAllocator ? pAllocator->pfnAllocation(pAllocator->pUserData, bytes, alignment, allocationScope)
-	                  : sw::allocateZero(bytes, alignment);
+	                  : sw::allocateZeroOrPoison(bytes, alignment);
 }
 
 void freeHostMemory(void *ptr, const VkAllocationCallbacks *pAllocator)