From d68ae35c1153c6263292d60e4f5f6b828d7c8e8f Mon Sep 17 00:00:00 2001 From: daurnimator Date: Wed, 20 Feb 2019 13:28:56 +1100 Subject: [PATCH] std: when a FixedBufferAllocator is initialised, set the buffer to undefined --- std/heap.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/std/heap.zig b/std/heap.zig index e257977f9d..b76850325c 100644 --- a/std/heap.zig +++ b/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,