aboutsummaryrefslogtreecommitdiff
path: root/Application/Loader
diff options
context:
space:
mode:
authorMatthijs Lavrijsen <mattiwatti@gmail.com>2023-03-26 16:36:44 +0200
committerMatthijs Lavrijsen <mattiwatti@gmail.com>2023-03-26 16:36:44 +0200
commit83bb58f2f48b1aa557172adb2f662ba3750daa78 (patch)
tree13e653fb4140d3eddbcc51e7a1a11427d9019c74 /Application/Loader
parent82b91beedf492b3725d987bfa2e5001f33686007 (diff)
Loader: handle EFI_SECURITY_VIOLATION from LoadImage
This behaviour matches that of edk2's UefiBootManagerLib since edk2 commit f7fdd620e8
Diffstat (limited to 'Application/Loader')
-rw-r--r--Application/Loader/Loader.c4
1 files changed, 4 insertions, 0 deletions
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;
}