Kernel: fix ext2 failed creation memory leak

This commit is contained in:
Bananymous 2023-04-01 00:22:03 +03:00
parent 3a4557d417
commit 5da801d12b
1 changed files with 2 additions and 0 deletions

View File

@ -438,8 +438,10 @@ namespace Kernel
Ext2FS* ext2fs = new Ext2FS(partition);
if (ext2fs == nullptr)
return BAN::Error::from_errno(ENOMEM);
BAN::ScopeGuard guard([ext2fs] { delete ext2fs; });
TRY(ext2fs->initialize_superblock());
TRY(ext2fs->initialize_root_inode());
guard.disable();
return ext2fs;
}