// error is expected. getting size to allocate\r
//\r
FileInfo = AllocateZeroPool(FileInfoSize);\r
- //\r
- // now get the information\r
- //\r
- Status = FileHandle->GetInfo(FileHandle,\r
- &gEfiFileInfoGuid,\r
- &FileInfoSize,\r
- FileInfo);\r
- //\r
- // if we got an error free the memory and return NULL\r
- //\r
- if (EFI_ERROR(Status) && (FileInfo != NULL)) {\r
- FreePool(FileInfo);\r
- FileInfo = NULL;\r
+ if (FileInfo != NULL) {\r
+ //\r
+ // now get the information\r
+ //\r
+ Status = FileHandle->GetInfo(FileHandle,\r
+ &gEfiFileInfoGuid,\r
+ &FileInfoSize,\r
+ FileInfo);\r
+ //\r
+ // if we got an error free the memory and return NULL\r
+ //\r
+ if (EFI_ERROR(Status)) {\r
+ FreePool(FileInfo);\r
+ FileInfo = NULL;\r
+ }\r
}\r
}\r
return (FileInfo);\r