mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 21:08:36 +00:00
std: when a FixedBufferAllocator is initialised, set the buffer to undefined
This commit is contained in:
parent
da7880b4cf
commit
d68ae35c11
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user