From 2855036f72b72b54ef30373277e1c7a189f0c1b4 Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Sat, 26 Dec 2015 16:17:18 -0600 Subject: [PATCH] Remove modules from the object table if they fail to load. --- src/xenia/kernel/kernel_state.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/xenia/kernel/kernel_state.cc b/src/xenia/kernel/kernel_state.cc index 68f8d00af..420fe12d6 100644 --- a/src/xenia/kernel/kernel_state.cc +++ b/src/xenia/kernel/kernel_state.cc @@ -303,13 +303,18 @@ object_ref KernelState::LoadUserModule(const char* raw_name, } } + global_lock.unlock(); + // Module wasn't loaded, so load it. module = object_ref(new UserModule(this, path.c_str())); X_STATUS status = module->LoadFromFile(path); if (XFAILED(status)) { + object_table()->RemoveHandle(module->handle()); return nullptr; } + global_lock.lock(); + // Retain when putting into the listing. module->Retain(); user_modules_.push_back(module);