1) Removing ASSERTs for proper return values.

2) Verifying that memory allocations were successful.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10904 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jcarsey
2010-10-04 16:24:30 +00:00
parent aca84419c4
commit 3c865f2064
7 changed files with 328 additions and 226 deletions

View File

@ -32,17 +32,23 @@ GetManFileName(
)
{
CHAR16 *Buffer;
ASSERT(ManFileName != NULL);
if (ManFileName == NULL) {
return (NULL);
}
//
// Fix the file name
//
if (StrnCmp(ManFileName+StrLen(ManFileName)-4, L".man", 4)==0) {
Buffer = AllocateZeroPool(StrSize(ManFileName));
StrCpy(Buffer, ManFileName);
if (Buffer != NULL) {
StrCpy(Buffer, ManFileName);
}
} else {
Buffer = AllocateZeroPool(StrSize(ManFileName) + 4*sizeof(CHAR16));
StrCpy(Buffer, ManFileName);
StrCat(Buffer, L".man");
if (Buffer != NULL) {
StrCpy(Buffer, ManFileName);
StrCat(Buffer, L".man");
}
}
return (Buffer);
}