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>
FileContext = (FILE_CONTEXT *) MenuEntry->VariableContext;\r
\r
if (!FileContext->IsRoot) {\r
- FreePool (FileContext->DevicePath);\r
+ if (FileContext->DevicePath != NULL) {\r
+ FreePool (FileContext->DevicePath);\r
+ }\r
} else {\r
if (FileContext->FileHandle != NULL) {\r
FileContext->FileHandle->Close (FileContext->FileHandle);\r
\r
FreePool (FileContext);\r
\r
- FreePool (MenuEntry->DisplayString);\r
+ if (MenuEntry->DisplayString != NULL) {\r
+ FreePool (MenuEntry->DisplayString);\r
+ }\r
if (MenuEntry->HelpString != NULL) {\r
FreePool (MenuEntry->HelpString);\r
}\r