Browse Source

[efi] Unload our own image before exiting UEFI application

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 years ago
parent
commit
f618178e60
1 changed files with 9 additions and 4 deletions
  1. 9
    4
      src/arch/x86/prefix/efiprefix.c

+ 9
- 4
src/arch/x86/prefix/efiprefix.c View File

@@ -37,11 +37,16 @@ EFI_STATUS EFIAPI _efi_start ( EFI_HANDLE image_handle,
37 37
 
38 38
 	/* Initialise EFI environment */
39 39
 	if ( ( efirc = efi_init ( image_handle, systab ) ) != 0 )
40
-		return efirc;
40
+		goto err_init;
41 41
 
42 42
 	/* Call to main() */
43
-	if ( ( rc = main() ) != 0 )
44
-		return EFIRC ( rc );
43
+	if ( ( rc = main() ) != 0 ) {
44
+		efirc = EFIRC ( rc );
45
+		goto err_main;
46
+	}
45 47
 
46
-	return 0;
48
+ err_main:
49
+	efi_loaded_image->Unload ( image_handle );
50
+ err_init:
51
+	return efirc;
47 52
 }

Loading…
Cancel
Save