/* Convert command line to UCS-2 */
loaded_image = grub_efi_get_loaded_image (image_handle);
+ if (loaded_image == NULL)
+ {
+ grub_error (GRUB_ERR_BAD_FIRMWARE, "missing loaded_image proto");
+ goto unload;
+ }
loaded_image->load_options_size = len =
(grub_strlen (args) + 1) * sizeof (grub_efi_char16_t);
loaded_image->load_options =
status = b->start_image (image_handle, 0, NULL);
/* When successful, not reached */
- b->unload_image (image_handle);
+ grub_error (GRUB_ERR_BAD_OS, "start_image() returned %" PRIuGRUB_EFI_UINTN_T, status);
grub_efi_free_pages ((grub_addr_t) loaded_image->load_options,
GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size));
+unload:
+ b->unload_image (image_handle);
return grub_errno;
}