diff options
author | Liam <byteslice@airmail.cc> | 2023-03-07 06:13:05 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2023-03-13 03:09:08 +0100 |
commit | 91fd4e30f2a12868201b08e73de299db1c3d116a (patch) | |
tree | ac85044f0554995ef6af3a3d9a4508286c2b95b3 /src/core/hle/kernel/svc/svc_code_memory.cpp | |
parent | kernel: convert miscellaneous (diff) | |
download | yuzu-91fd4e30f2a12868201b08e73de299db1c3d116a.tar yuzu-91fd4e30f2a12868201b08e73de299db1c3d116a.tar.gz yuzu-91fd4e30f2a12868201b08e73de299db1c3d116a.tar.bz2 yuzu-91fd4e30f2a12868201b08e73de299db1c3d116a.tar.lz yuzu-91fd4e30f2a12868201b08e73de299db1c3d116a.tar.xz yuzu-91fd4e30f2a12868201b08e73de299db1c3d116a.tar.zst yuzu-91fd4e30f2a12868201b08e73de299db1c3d116a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/svc/svc_code_memory.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/hle/kernel/svc/svc_code_memory.cpp b/src/core/hle/kernel/svc/svc_code_memory.cpp index 8bed747af..43feab986 100644 --- a/src/core/hle/kernel/svc/svc_code_memory.cpp +++ b/src/core/hle/kernel/svc/svc_code_memory.cpp @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include "common/scope_exit.h" #include "core/core.h" #include "core/hle/kernel/k_code_memory.h" #include "core/hle/kernel/k_process.h" @@ -44,6 +45,7 @@ Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, uint64 KCodeMemory* code_mem = KCodeMemory::Create(kernel); R_UNLESS(code_mem != nullptr, ResultOutOfResource); + SCOPE_EXIT({ code_mem->Close(); }); // Verify that the region is in range. R_UNLESS(GetCurrentProcess(system.Kernel()).PageTable().Contains(address, size), @@ -58,9 +60,7 @@ Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, uint64 // Add the code memory to the handle table. R_TRY(GetCurrentProcess(system.Kernel()).GetHandleTable().Add(out, code_mem)); - code_mem->Close(); - - return ResultSuccess; + R_SUCCEED(); } Result ControlCodeMemory(Core::System& system, Handle code_memory_handle, @@ -140,10 +140,10 @@ Result ControlCodeMemory(Core::System& system, Handle code_memory_handle, R_TRY(code_mem->UnmapFromOwner(address, size)); } break; default: - return ResultInvalidEnumValue; + R_THROW(ResultInvalidEnumValue); } - return ResultSuccess; + R_SUCCEED(); } Result CreateCodeMemory64(Core::System& system, Handle* out_handle, uint64_t address, |