loader/efi/linux: Fix memory leak
PATCH 1/2 loader/efi/linux: Fix memory leak
From: khaalid <[email protected]>
It was forgotten to free mempath entirely.
--- grub-core/loader/efi/linux.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
grub-core/loader/efi/linux.c +8 -1
@@ -212,8 +212,11 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args) (grub_efi_device_path_t *) mempath, (void *) addr, size, &image_handle);if (status !=GRUB_EFI_SUCCESS ) + { +grub_free (mempath);return grub_error (GRUB_ERR_BAD_OS ,"cannot load image 0x%lx" , status); - + } +grub_dprintf ("linux" ,"linux command line: '%s'\n" , args);/* Convert command line to UTF-16. */
@@ -228,7 +231,10 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args) loaded_image->load_options =grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (len));if (!loaded_image->load_options) + { +grub_free (mempath);return grub_errno; + } loaded_image->load_options_size = 2 * grub_utf8_to_utf16 (loaded_image->load_options, len,
@@ -242,6 +248,7 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)grub_efi_free_pages ((grub_addr_t ) loaded_image->load_options,GRUB_EFI_BYTES_TO_PAGES (len)); loaded_image->load_options =NULL ; +grub_free (mempath); unload: b->unload_image (image_handle);
Signature · 7 lines
2.49.0 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
The patch set is missing cover letter.
Quoted 1 line · khaalid cali
From: khaalid <[email protected]>
Again, you can drop this from all patches.
Quoted 12 lines
It was forgotten to free mempath entirely.
Signed-off-by Khalid Ali <[email protected]>--- grub-core/loader/efi/linux.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)grub-core/loader/efi/linux.c +0
-0
grub-core/loader/efi/linux.c grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args) · line 216
Quoted 5 lines
grub-core/loader/efi/linux.c +2
-0@@ -212,8 +212,11 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args) (grub_efi_device_path_t *) mempath, (void *) addr, size, &image_handle);if (status !=GRUB_EFI_SUCCESS ) + { +grub_free (mempath);
Wrong coding style, missing space before "(". Please fix this in all patches.
grub-core/loader/efi/linux.c grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args) · line 217
Quoted 1 line
grub-core/loader/efi/linux.c +0
-0return grub_error (GRUB_ERR_BAD_OS ,"cannot load image 0x%lx" , status);
This line suggests the patch adding status code to the error message should be part of this series.
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel