tmpfs: use adopt_shared_if_nonnull instead of plain adopt_shared in FileSystem::create()

This commit is contained in:
apio 2023-03-07 22:16:52 +01:00
parent 293be2c75a
commit abdd460525
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -7,7 +7,7 @@ namespace TmpFS
{ {
Result<SharedPtr<VFS::FileSystem>> FileSystem::create() Result<SharedPtr<VFS::FileSystem>> FileSystem::create()
{ {
SharedPtr<FileSystem> fs = TRY(adopt_shared(new (std::nothrow) FileSystem())); SharedPtr<FileSystem> fs = TRY(adopt_shared_if_nonnull(new (std::nothrow) FileSystem()));
SharedPtr<VFS::Inode> root = TRY(fs->create_dir_inode({})); SharedPtr<VFS::Inode> root = TRY(fs->create_dir_inode({}));
fs->set_root(root); fs->set_root(root);
return (SharedPtr<VFS::FileSystem>)fs; return (SharedPtr<VFS::FileSystem>)fs;