From fc58baf54d48151690b3f7696470c3c13fa7f8c6 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 9 Mar 2023 02:17:42 +0200 Subject: [PATCH] Kernel: if VFS initialization does not find root, we fail --- kernel/kernel/FS/VirtualFileSystem.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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()