Fix a bug introduced when removing the SafeFreePool. Pointer should be checked before FreePool.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6349 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2008-10-31 06:35:23 +00:00
parent f7763aa493
commit c473cc1756
1 changed files with 9 additions and 3 deletions

View File

@ -305,7 +305,9 @@ BdsLibRegisterNewOption (
// Got the option, so just return
//
FreePool (OptionPtr);
if (TempOptionPtr != NULL) {
FreePool (TempOptionPtr);
}
return EFI_SUCCESS;
} else {
//
@ -364,7 +366,9 @@ BdsLibRegisterNewOption (
//
if (EFI_ERROR (Status) || UpdateDescription) {
FreePool (OptionPtr);
if (TempOptionPtr != NULL) {
FreePool (TempOptionPtr);
}
return Status;
}
@ -386,7 +390,9 @@ BdsLibRegisterNewOption (
sizeof (UINT16),
&BootOrderEntry
);
if (TempOptionPtr != NULL) {
FreePool (TempOptionPtr);
}
return Status;
}