barebox bootm handlers are supposed to check the dry run flag.

While at it, also fix the code to free initrd in error paths.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
 efi/payload/bootm.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/efi/payload/bootm.c b/efi/payload/bootm.c
index 8e7ba4561f3f..38bc8b23f215 100644
--- a/efi/payload/bootm.c
+++ b/efi/payload/bootm.c
@@ -252,15 +252,16 @@ static int do_bootm_efi_stub(struct image_data *data)
                goto unload_oftree;
 
        type = file_detect_type(loaded_image->image_base, PAGE_SIZE);
-       ret = efi_execute_image(handle, loaded_image, type);
-       if (ret)
+
+       if (data->dryrun)
                goto unload_ramdisk;
 
-       return 0;
-
+       ret = efi_execute_image(handle, loaded_image, type);
 unload_ramdisk:
-       if (initrd)
+       if (initrd) {
                efi_initrd_unregister();
+               free(initrd);
+       }
 unload_oftree:
        efi_unload_fdt(fdt);
 unload_os:
-- 
2.47.3


Reply via email to