]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Unload our own image before exiting UEFI application
authorMichael Brown <mcb30@ipxe.org>
Fri, 14 Mar 2014 15:56:36 +0000 (15:56 +0000)
committerMichael Brown <mcb30@ipxe.org>
Fri, 14 Mar 2014 16:20:55 +0000 (16:20 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/x86/prefix/efiprefix.c

index 475ea505c74644299d55c288ae1aed12e9be63bd..eb8aa738a6e7c706654aadb9332548dc7637b6d6 100644 (file)
@@ -37,11 +37,16 @@ EFI_STATUS EFIAPI _efi_start ( EFI_HANDLE image_handle,
 
        /* Initialise EFI environment */
        if ( ( efirc = efi_init ( image_handle, systab ) ) != 0 )
-               return efirc;
+               goto err_init;
 
        /* Call to main() */
-       if ( ( rc = main() ) != 0 )
-               return EFIRC ( rc );
+       if ( ( rc = main() ) != 0 ) {
+               efirc = EFIRC ( rc );
+               goto err_main;
+       }
 
-       return 0;
+ err_main:
+       efi_loaded_image->Unload ( image_handle );
+ err_init:
+       return efirc;
 }