Fix use-after-free error in ELF loader (only manifested in QEMU).