From: Khalid Ali <[email protected]> Add two wrappers to close device path and loaded image protocols after they have been used.
Callers who wish to close device path or loaded image protocol should call these wrappers. Signed-off-by: Khalid Ali <[email protected]> --- grub-core/kern/efi/efi.c | 13 +++++++++++++ include/grub/efi/efi.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c index 77456835e..befb4b3f4 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -163,6 +163,12 @@ grub_efi_get_loaded_image (grub_efi_handle_t image_handle) GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); } +grub_efi_status_t +grub_efi_close_loaded_image (grub_efi_handle_t image_handle) +{ + return grub_efi_close_protocol (image_handle, &loaded_image_guid); +} + void grub_reboot (void) { @@ -371,6 +377,7 @@ grub_efi_section_addr (const char *section_name) grub_dprintf("sections", "returning section info for section %d: \"%s\"\n", i, section->name); + grub_efi_close_loaded_image (grub_efi_image_handle); return (grub_addr_t) info; } @@ -494,6 +501,12 @@ grub_efi_get_device_path (grub_efi_handle_t handle) GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); } +grub_efi_status_t +grub_efi_close_device_path (grub_efi_handle_t handle) +{ + return grub_efi_close_protocol (handle, &device_path_guid); +} + /* Return the device path node right before the end node. */ grub_efi_device_path_t * grub_efi_find_last_device_path (const grub_efi_device_path_t *dp) diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h index b4d2f2d46..5a6e471ba 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -72,10 +72,12 @@ EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size, grub_efi_uint32_t *descriptor_version); void grub_efi_memory_fini (void); grub_efi_loaded_image_t *EXPORT_FUNC(grub_efi_get_loaded_image) (grub_efi_handle_t image_handle); +grub_efi_status_t EXPORT_FUNC(grub_efi_close_loaded_image) (grub_efi_handle_t image_handle); void EXPORT_FUNC(grub_efi_print_device_path) (grub_efi_device_path_t *dp); char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp); grub_efi_device_path_t * EXPORT_FUNC(grub_efi_get_device_path) (grub_efi_handle_t handle); +grub_efi_status_t EXPORT_FUNC(grub_efi_close_device_path) (grub_efi_handle_t handle); grub_efi_device_path_t * EXPORT_FUNC(grub_efi_find_last_device_path) (const grub_efi_device_path_t *dp); grub_efi_device_path_t * -- 2.52.0 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
