void __attribute__((noreturn)) __libctru_exit(int rc) { u32 tmp=0; if(__system_argv) free(__system_argv); // Unmap the linear heap svcControlMemory(&tmp, __linear_heap, 0x0, __linear_heap_size, MEMOP_FREE, 0x0); // Unmap the application heap svcControlMemory(&tmp, __heapBase, 0x0, __heap_size, MEMOP_FREE, 0x0); if (__stack_size_extra) svcControlMemory(&tmp, __stack_bottom, 0x0, __stack_size_extra, MEMOP_FREE, 0x0); // Close some handles envDestroyHandles(); if (__sync_fini) __sync_fini(); // Jump to the loader if it provided a callback if (__system_retAddr) __system_retAddr(); // Since above did not jump, end this process svcExitProcess(); }
void __ctru_exit() { __appExit(); __sync_fini(); svcExitProcess(); }