std: when a FixedBufferAllocator is initialised, set the buffer to undefined

master
daurnimator 2019-02-20 13:28:56 +11:00
parent da7880b4cf
commit d68ae35c11
No known key found for this signature in database
GPG Key ID: 45B429A8F9D9D22A
1 changed files with 4 additions and 0 deletions

View File

@ -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,