summaryrefslogtreecommitdiffstats
path: root/src/core/loader
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2014-07-05 02:32:06 +0200
committerbunnei <bunneidev@gmail.com>2014-07-05 02:37:51 +0200
commitb70c4fb48ec32057e56d9c0373794670bddd4f34 (patch)
tree6bb6ab148504beaacdfa02ed1dd069e3a5f61427 /src/core/loader
parentArchive: Added Init/Shutdown methods to reset kernel archive state. (diff)
downloadyuzu-b70c4fb48ec32057e56d9c0373794670bddd4f34.tar
yuzu-b70c4fb48ec32057e56d9c0373794670bddd4f34.tar.gz
yuzu-b70c4fb48ec32057e56d9c0373794670bddd4f34.tar.bz2
yuzu-b70c4fb48ec32057e56d9c0373794670bddd4f34.tar.lz
yuzu-b70c4fb48ec32057e56d9c0373794670bddd4f34.tar.xz
yuzu-b70c4fb48ec32057e56d9c0373794670bddd4f34.tar.zst
yuzu-b70c4fb48ec32057e56d9c0373794670bddd4f34.zip
Diffstat (limited to 'src/core/loader')
-rw-r--r--src/core/loader/loader.h1
-rw-r--r--src/core/loader/ncch.cpp7
2 files changed, 7 insertions, 1 deletions
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h
index c27b5b4b6..4ba10de52 100644
--- a/src/core/loader/loader.h
+++ b/src/core/loader/loader.h
@@ -32,6 +32,7 @@ enum class ResultStatus {
ErrorNotLoaded,
ErrorNotUsed,
ErrorAlreadyLoaded,
+ ErrorMemoryAllocationFailed,
};
/// Interface for loading an application
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp
index a82338904..ba27eb75a 100644
--- a/src/core/loader/ncch.cpp
+++ b/src/core/loader/ncch.cpp
@@ -157,7 +157,12 @@ ResultStatus AppLoader_NCCH::LoadSectionExeFS(const char* name, std::vector<u8>&
// Section is compressed...
if (i == 0 && is_compressed) {
// Read compressed .code section...
- std::unique_ptr<u8[]> temp_buffer(new u8[exefs_header.section[i].size]);
+ std::unique_ptr<u8[]> temp_buffer;
+ try {
+ temp_buffer.reset(new u8[exefs_header.section[i].size]);
+ } catch (std::bad_alloc&) {
+ return ResultStatus::ErrorMemoryAllocationFailed;
+ }
file.ReadBytes(&temp_buffer[0], exefs_header.section[i].size);
// Decompress .code section...