From 3c35345e38d716aa5d67d9a483a381693fa270e4 Mon Sep 17 00:00:00 2001 From: longpanda Date: Mon, 1 Mar 2021 17:49:10 +0800 Subject: [PATCH] remove the ASSERT warning in UEFI mode when boot fail. --- .../MdeModulePkg/Application/Ventoy/Ventoy.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.c b/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.c index c560bcbc..56d650f1 100644 --- a/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.c +++ b/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.c @@ -42,6 +42,7 @@ BOOLEAN gLoadIsoEfi = FALSE; BOOLEAN gIsoUdf = FALSE; ventoy_ram_disk g_ramdisk_param; ventoy_chain_head *g_chain; +void *g_vtoy_img_location_buf; ventoy_img_chunk *g_chunk; UINT8 *g_os_param_reserved; UINT32 g_img_chunk_num; @@ -269,6 +270,7 @@ static int ventoy_update_image_location(ventoy_os_param *param) } address = (UINTN)buffer; + g_vtoy_img_location_buf = buffer; if (address % 4096) { @@ -873,12 +875,15 @@ EFI_STATUS EFIAPI ventoy_clean_env(VOID) ventoy_delete_variable(); - if (g_chain->os_param.vtoy_img_location_addr) + if (g_vtoy_img_location_buf) { - FreePool((VOID *)(UINTN)g_chain->os_param.vtoy_img_location_addr); + FreePool(g_vtoy_img_location_buf); } - FreePool(g_chain); + if (!gMemdiskMode) + { + FreePool(g_chain); + } return EFI_SUCCESS; }