From 83bb58f2f48b1aa557172adb2f662ba3750daa78 Mon Sep 17 00:00:00 2001 From: Matthijs Lavrijsen Date: Sun, 26 Mar 2023 16:36:44 +0200 Subject: Loader: handle EFI_SECURITY_VIOLATION from LoadImage This behaviour matches that of edk2's UefiBootManagerLib since edk2 commit f7fdd620e8 --- Application/Loader/Loader.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Application/Loader') diff --git a/Application/Loader/Loader.c b/Application/Loader/Loader.c index 801fdf9..7b7f7aa 100644 --- a/Application/Loader/Loader.c +++ b/Application/Loader/Loader.c @@ -542,6 +542,10 @@ TryBootOptionsInOrder( if (EFI_ERROR(Status)) { + // Unload if execution could not be deferred to avoid a resource leak + if (Status == EFI_SECURITY_VIOLATION) + gBS->UnloadImage(ImageHandle); + Print(L"LoadImage error %llx (%r)\r\n", Status, Status); continue; } -- cgit v1.2.3