summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Library/FileExplorerLib/FileExplorer.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
index 9714dbcf5d..98c81dbef9 100644
--- a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
+++ b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c
@@ -302,7 +302,9 @@ LibDestroyMenuEntry (
FileContext = (FILE_CONTEXT *) MenuEntry->VariableContext;
if (!FileContext->IsRoot) {
- FreePool (FileContext->DevicePath);
+ if (FileContext->DevicePath != NULL) {
+ FreePool (FileContext->DevicePath);
+ }
} else {
if (FileContext->FileHandle != NULL) {
FileContext->FileHandle->Close (FileContext->FileHandle);
@@ -315,7 +317,9 @@ LibDestroyMenuEntry (
FreePool (FileContext);
- FreePool (MenuEntry->DisplayString);
+ if (MenuEntry->DisplayString != NULL) {
+ FreePool (MenuEntry->DisplayString);
+ }
if (MenuEntry->HelpString != NULL) {
FreePool (MenuEntry->HelpString);
}