summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/FileExplorerLib
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2016-02-29 10:08:47 +0800
committerFeng Tian <feng.tian@intel.com>2016-03-02 12:10:15 +0800
commitbbd6b0106e9e725853d12550527aa03f11c09fcf (patch)
tree794f463a263ee7a98e8bfe39e10f92049aa20e11 /MdeModulePkg/Library/FileExplorerLib
parent0b966ddd61a90b3ba116c2eeaa93ee4247832a1a (diff)
downloadedk2-bbd6b0106e9e725853d12550527aa03f11c09fcf.tar.gz
edk2-bbd6b0106e9e725853d12550527aa03f11c09fcf.tar.bz2
edk2-bbd6b0106e9e725853d12550527aa03f11c09fcf.zip
MdeModulePkg: FileExplorerLib: Add check when to call FreePool function
when free up resource allocated for a MenuEntry, there exists the case that the DevicePath and DisplayString are NULL, so before calling FreePool function, need to check. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
Diffstat (limited to 'MdeModulePkg/Library/FileExplorerLib')
-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);
}