/* This function cleans up the file list and any related data structures. It has no impact on the files themselves. */
EFI_STATUS EFIAPI EfiShellFreeFileList(IN EFI_SHELL_FILE_INFO **FileList)
/* This function cleans up the file list and any related data structures. It has no impact on the files themselves. */
EFI_STATUS EFIAPI EfiShellFreeFileList(IN EFI_SHELL_FILE_INFO **FileList)
{
  EFI_SHELL_FILE_INFO  *ShellFileListItem;
  if ((FileList == NULL) || (*FileList == NULL)) {
    return (EFI_INVALID_PARAMETER);
  }
  for ( ShellFileListItem = (EFI_SHELL_FILE_INFO *)GetFirstNode (&(*FileList)->Link)
        ; !IsListEmpty (&(*FileList)->Link)
        ; ShellFileListItem = (EFI_SHELL_FILE_INFO *)GetFirstNode (&(*FileList)->Link)
        )
  {
    RemoveEntryList (&ShellFileListItem->Link);
    InternalFreeShellFileInfoNode (ShellFileListItem);
  }
  InternalFreeShellFileInfoNode (*FileList);
  *FileList = NULL;
  return (EFI_SUCCESS);
}