diff --git a/kernel/kernel/FS/VirtualFileSystem.cpp b/kernel/kernel/FS/VirtualFileSystem.cpp index 589dd7c6c1..fcd285ed2e 100644 --- a/kernel/kernel/FS/VirtualFileSystem.cpp +++ b/kernel/kernel/FS/VirtualFileSystem.cpp @@ -16,7 +16,15 @@ namespace Kernel s_instance = new VirtualFileSystem(); if (s_instance == nullptr) return BAN::Error::from_errno(ENOMEM); - return s_instance->initialize_impl(); + + if (auto res = s_instance->initialize_impl(); res.is_error()) + { + delete s_instance; + s_instance = nullptr; + return res; + } + + return {}; } VirtualFileSystem& VirtualFileSystem::get()