kernel/fxf: Free memory used by binary if relocation fails

main
Ry 2023-07-13 23:58:59 -07:00
parent 50ea28fc7e
commit b3d9a4a6eb
1 changed files with 15 additions and 1 deletions

View File

@ -102,7 +102,7 @@ launch_fxf_from_open_file_1:
mov r0, [launch_fxf_binary_ptr]
call parse_fxf_binary
cmp r0, 0
ifz jmp launch_fxf_from_disk_file_error
ifz jmp launch_fxf_from_disk_reloc_error
; create a new task
mov r1, r0
@ -139,6 +139,20 @@ launch_fxf_from_disk_file_error:
pop r1
mov r0, 0xFFFFFFFF
ret
launch_fxf_from_disk_reloc_error:
mov r0, [launch_fxf_binary_ptr]
call free_memory
mov r0, [launch_fxf_stack_ptr]
call free_memory
pop r6
pop r5
pop r4
pop r3
pop r2
pop r1
mov r0, 0xFFFFFFFF
ret
launch_fxf_struct_ptr: data.32 0
launch_fxf_struct: data.fill 0, 32