mirror of
https://github.com/wiiu-env/FunctionPatcherModule.git
synced 2024-11-17 15:29:23 +01:00
PatchedFunctionData. Actually return on error instead of allocating even more memory
This commit is contained in:
parent
b1320f0c8d
commit
1e2457b266
@ -29,6 +29,11 @@ std::optional<std::shared_ptr<PatchedFunctionData>> PatchedFunctionData::make_sh
|
||||
|
||||
ptr->jumpToOriginal = (uint32_t *) MEMAllocFromExpHeapEx(ptr->heapHandle, 0x5 * sizeof(uint32_t), 4);
|
||||
|
||||
if (!ptr->jumpToOriginal) {
|
||||
DEBUG_FUNCTION_LINE_ERR("Failed to alloc jump data");
|
||||
return {};
|
||||
}
|
||||
|
||||
if (ptr->replacementFunctionAddress > 0x01FFFFFC || ptr->targetProcess != FP_TARGET_PROCESS_ALL) {
|
||||
ptr->jumpDataSize = 15; // We could predict the actual size and save some memory, but at the moment we don't need it.
|
||||
ptr->jumpData = (uint32_t *) MEMAllocFromExpHeapEx(ptr->heapHandle, ptr->jumpDataSize * sizeof(uint32_t), 4);
|
||||
@ -39,11 +44,6 @@ std::optional<std::shared_ptr<PatchedFunctionData>> PatchedFunctionData::make_sh
|
||||
}
|
||||
}
|
||||
|
||||
if (!ptr->jumpToOriginal) {
|
||||
DEBUG_FUNCTION_LINE_ERR("Failed to alloc jump data");
|
||||
return {};
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user