fix: zero initialize all allocated memory

This commit is contained in:
2022-10-21 05:12:15 -03:00
parent fce560dd89
commit bbd73550e8
4 changed files with 28 additions and 22 deletions

View File

@@ -7,8 +7,11 @@ buf: []u8,
alloc: Allocator,
pub fn init(alloc: Allocator) !Self {
const buf = try alloc.alloc(u8, 0x8000);
std.mem.set(u8, buf, 0);
return Self{
.buf = try alloc.alloc(u8, 0x8000),
.buf = buf,
.alloc = alloc,
};
}

View File

@@ -7,8 +7,11 @@ buf: []u8,
alloc: Allocator,
pub fn init(alloc: Allocator) !Self {
const buf = try alloc.alloc(u8, 0x40000);
std.mem.set(u8, buf, 0);
return Self{
.buf = try alloc.alloc(u8, 0x40000),
.buf = buf,
.alloc = alloc,
};
}