diff --git a/kernel/src/fs/ext2/Inode.cpp b/kernel/src/fs/ext2/Inode.cpp index 872195c5..8c132e79 100644 --- a/kernel/src/fs/ext2/Inode.cpp +++ b/kernel/src/fs/ext2/Inode.cpp @@ -91,19 +91,18 @@ namespace Ext2 const usize inode_size = m_metadata.size; const usize block_size = m_fs->m_block_size; - u8* const buf = (u8*)TRY(calloc_impl(block_size, 1)); - auto guard = make_scope_guard([buf] { free_impl(buf); }); + auto buf = TRY(Buffer::create_sized(block_size)); m_entries.clear(); for (usize offset = 0; offset < inode_size; offset += block_size) { - TRY(read(buf, offset, block_size)); + TRY(read(buf.data(), offset, block_size)); usize dir_offset = 0; while (dir_offset < block_size) { - auto& entry = *(Ext2::RawDirectoryEntry*)&buf[dir_offset]; + auto& entry = *(Ext2::RawDirectoryEntry*)&buf.data()[dir_offset]; if (entry.inum != 0) {