|
@@ -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
|
}
|