Commit d68ae35c11

daurnimator <quae@daurnimator.com>
2019-02-20 03:28:56
std: when a FixedBufferAllocator is initialised, set the buffer to undefined
1 parent da7880b
Changed files (1)
std/heap.zig
@@ -273,6 +273,10 @@ pub const FixedBufferAllocator = struct {
     buffer: []u8,
 
     pub fn init(buffer: []u8) FixedBufferAllocator {
+        // This loop gets optimized out in ReleaseFast mode
+        for (buffer) |*byte| {
+            byte.* = undefined;
+        }
         return FixedBufferAllocator{
             .allocator = Allocator{
                 .allocFn = alloc,