rts: Fix memory leak when loading ELF objects