/* Free up all resource allocated for a BM_MENU_ENTRY. */
VOID LibDestroyMenuEntry(MENU_ENTRY *MenuEntry)
/* Free up all resource allocated for a BM_MENU_ENTRY. */
VOID LibDestroyMenuEntry(MENU_ENTRY *MenuEntry)
{
  FILE_CONTEXT  *FileContext;
  FileContext = (FILE_CONTEXT *)MenuEntry->VariableContext;
  if (!FileContext->IsRoot) {
    if (FileContext->DevicePath != NULL) {
      FreePool (FileContext->DevicePath);
    }
  } else {
    if (FileContext->FileHandle != NULL) {
      FileContext->FileHandle->Close (FileContext->FileHandle);
    }
  }
  if (FileContext->FileName != NULL) {
    FreePool (FileContext->FileName);
  }
  FreePool (FileContext);
  if (MenuEntry->DisplayString != NULL) {
    FreePool (MenuEntry->DisplayString);
  }
  if (MenuEntry->HelpString != NULL) {
    FreePool (MenuEntry->HelpString);
  }
  FreePool (MenuEntry);
}