mirror of https://github.com/acidanthera/audk.git
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>
This commit is contained in:
parent
0b966ddd61
commit
bbd6b0106e
|
@ -302,7 +302,9 @@ LibDestroyMenuEntry (
|
||||||
FileContext = (FILE_CONTEXT *) MenuEntry->VariableContext;
|
FileContext = (FILE_CONTEXT *) MenuEntry->VariableContext;
|
||||||
|
|
||||||
if (!FileContext->IsRoot) {
|
if (!FileContext->IsRoot) {
|
||||||
|
if (FileContext->DevicePath != NULL) {
|
||||||
FreePool (FileContext->DevicePath);
|
FreePool (FileContext->DevicePath);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (FileContext->FileHandle != NULL) {
|
if (FileContext->FileHandle != NULL) {
|
||||||
FileContext->FileHandle->Close (FileContext->FileHandle);
|
FileContext->FileHandle->Close (FileContext->FileHandle);
|
||||||
|
@ -315,7 +317,9 @@ LibDestroyMenuEntry (
|
||||||
|
|
||||||
FreePool (FileContext);
|
FreePool (FileContext);
|
||||||
|
|
||||||
|
if (MenuEntry->DisplayString != NULL) {
|
||||||
FreePool (MenuEntry->DisplayString);
|
FreePool (MenuEntry->DisplayString);
|
||||||
|
}
|
||||||
if (MenuEntry->HelpString != NULL) {
|
if (MenuEntry->HelpString != NULL) {
|
||||||
FreePool (MenuEntry->HelpString);
|
FreePool (MenuEntry->HelpString);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue