aboutsummaryrefslogtreecommitdiff
path: root/Application/Loader
diff options
context:
space:
mode:
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;
}