This function converts a file system style name to a device path, by replacing any\r
mapping references to the associated device path.\r
\r
- @param Path the pointer to the path\r
+ @param[in] Path The pointer to the path.\r
\r
- @return all The pointer of the file path. The file path is callee\r
+ @return The pointer of the file path. The file path is callee\r
allocated and should be freed by the caller.\r
+ @retval NULL The path could not be found.\r
+ @retval NULL There was not enough available memory.\r
**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
EFIAPI\r
Size = StrSize(Cwd);\r
Size += StrSize(Path);\r
NewPath = AllocateZeroPool(Size);\r
- ASSERT(NewPath != NULL);\r
+ if (NewPath == NULL) {\r
+ return (NULL);\r
+ }\r
StrCpy(NewPath, Cwd);\r
if (*Path == L'\\') {\r
Path++;\r
//\r
ASSERT((MapName == NULL && Size == 0) || (MapName != NULL));\r
MapName = StrnCatGrow(&MapName, &Size, Path, (StrStr(Path, L":")-Path+1));\r
- if (MapName[StrLen(MapName)-1] != L':') {\r
- ASSERT(FALSE);\r
+ if (MapName == NULL || MapName[StrLen(MapName)-1] != L':') {\r
return (NULL);\r
}\r
\r
//\r
DevicePathCopyForFree = DevicePathCopy = DuplicateDevicePath(DevicePath);\r
if (DevicePathCopy == NULL) {\r
- ASSERT(FALSE);\r
FreePool(MapName);\r
return (NULL);\r
}\r
TempString = NULL;\r
Size = 0;\r
TempString = StrnCatGrow(&TempString, &Size, ShellFileHandleGetPath(FileDirHandle), 0);\r
+ if (TempString == NULL) {\r
+ return (EFI_OUT_OF_RESOURCES);\r
+ }\r
TempSpot = StrStr(TempString, L";");\r
\r
if (TempSpot != NULL) {\r
}\r
\r
TempString = StrnCatGrow(&TempString, &Size, BasePath, 0);\r
+ if (TempString == NULL) {\r
+ return (EFI_OUT_OF_RESOURCES);\r
+ }\r
BasePath = TempString;\r
}\r
\r
\r
ASSERT(MapName == NULL);\r
MapName = StrnCatGrow(&MapName, NULL, PatternCopy, Count);\r
+ if (MapName == NULL) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ }\r
\r
if (!EFI_ERROR(Status)) {\r
RootDevicePath = EfiShellGetDevicePathFromFilePath(PatternCopy);\r
MapListItem->CurrentDirectoryPath = StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, L"\\", 0);\r
ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));\r
MapListItem->CurrentDirectoryPath = StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, DirectoryName, 0);\r
- if (MapListItem->CurrentDirectoryPath[StrLen(MapListItem->CurrentDirectoryPath)-1] != L'\\') {\r
+ if (MapListItem->CurrentDirectoryPath != NULL && MapListItem->CurrentDirectoryPath[StrLen(MapListItem->CurrentDirectoryPath)-1] != L'\\') {\r
ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));\r
MapListItem->CurrentDirectoryPath = StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, L"\\", 0);\r
}\r