From 33faeb03a57c8197d5827dfdfd223255542f9863 Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 5 Oct 2022 20:19:22 +0200 Subject: [PATCH] Return an error if OSDynLoad_Acquire fails --- wumsloader/src/utils/RelocationUtils.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wumsloader/src/utils/RelocationUtils.cpp b/wumsloader/src/utils/RelocationUtils.cpp index d205db9..cbc348c 100644 --- a/wumsloader/src/utils/RelocationUtils.cpp +++ b/wumsloader/src/utils/RelocationUtils.cpp @@ -112,9 +112,13 @@ bool doRelocation(const std::vector> &moduleList, if (!usedRPls.contains(rplName)) { DEBUG_FUNCTION_LINE_VERBOSE("Acquire %s", rplName.c_str()); // Always acquire to increase refcount and make sure it won't get unloaded while we're using it. - OSDynLoad_Acquire(rplName.c_str(), &rplHandle); + OSDynLoad_Error err = OSDynLoad_Acquire(rplName.c_str(), &rplHandle); + if (err != OS_DYNLOAD_OK) { + DEBUG_FUNCTION_LINE_ERR("Failed to acquire %s", rplName.c_str()); + return false; + } // Keep track RPLs we are using. - // They will be released on exit in the AromaBaseModule + // They will be released on exit (See: AromaBaseModule) usedRPls[rplName] = rplHandle; } else { DEBUG_FUNCTION_LINE_VERBOSE("Use from usedRPLs cache! %s", rplName.c_str());