mirror of
https://github.com/wiiu-env/CustomRPXLoader.git
synced 2024-11-22 01:49:16 +01:00
Stop trying to free leaked memory
This commit is contained in:
parent
a6ea7512e5
commit
49c4c267c8
20
src/main.cpp
20
src/main.cpp
@ -72,11 +72,6 @@ extern "C" int _start(int argc, char **argv) {
|
|||||||
|
|
||||||
init_wut();
|
init_wut();
|
||||||
|
|
||||||
// Save last entry on mem2 heap to detect leaked memory
|
|
||||||
MEMHeapHandle mem2_heap_handle = MEMGetBaseHeapHandle(MEM_BASE_HEAP_MEM2);
|
|
||||||
auto heap = (MEMExpHeap *) mem2_heap_handle;
|
|
||||||
MEMExpHeapBlock *memory_start = heap->usedList.tail;
|
|
||||||
|
|
||||||
initLogging();
|
initLogging();
|
||||||
DEBUG_FUNCTION_LINE("Hello from CustomRPXLoader");
|
DEBUG_FUNCTION_LINE("Hello from CustomRPXLoader");
|
||||||
|
|
||||||
@ -84,21 +79,6 @@ extern "C" int _start(int argc, char **argv) {
|
|||||||
|
|
||||||
deinitLogging();
|
deinitLogging();
|
||||||
|
|
||||||
// free leaked memory
|
|
||||||
if (memory_start) {
|
|
||||||
int leak_count = 0;
|
|
||||||
while (true) {
|
|
||||||
MEMExpHeapBlock *memory_end = heap->usedList.tail;
|
|
||||||
if (memory_end == memory_start) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
auto mem_ptr = &memory_end[1]; // &memory_end + sizeof(MEMExpHeapBlock);
|
|
||||||
free(mem_ptr);
|
|
||||||
leak_count++;
|
|
||||||
}
|
|
||||||
OSReport("Freed %d leaked memory blocks\n", leak_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
fini_wut();
|
fini_wut();
|
||||||
|
|
||||||
if (entrypoint > 0) {
|
if (entrypoint > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user