From c473cc175602bb2c9aa02636c6a8b560d935130f Mon Sep 17 00:00:00 2001 From: qwang12 Date: Fri, 31 Oct 2008 06:35:23 +0000 Subject: [PATCH] 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 --- MdeModulePkg/Library/GenericBdsLib/BdsMisc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Library/GenericBdsLib/BdsMisc.c b/MdeModulePkg/Library/GenericBdsLib/BdsMisc.c index 994f90ed0d..3136341162 100644 --- a/MdeModulePkg/Library/GenericBdsLib/BdsMisc.c +++ b/MdeModulePkg/Library/GenericBdsLib/BdsMisc.c @@ -305,7 +305,9 @@ BdsLibRegisterNewOption ( // Got the option, so just return // FreePool (OptionPtr); - FreePool (TempOptionPtr); + if (TempOptionPtr != NULL) { + FreePool (TempOptionPtr); + } return EFI_SUCCESS; } else { // @@ -364,7 +366,9 @@ BdsLibRegisterNewOption ( // if (EFI_ERROR (Status) || UpdateDescription) { FreePool (OptionPtr); - FreePool (TempOptionPtr); + if (TempOptionPtr != NULL) { + FreePool (TempOptionPtr); + } return Status; } @@ -386,7 +390,9 @@ BdsLibRegisterNewOption ( sizeof (UINT16), &BootOrderEntry ); - FreePool (TempOptionPtr); + if (TempOptionPtr != NULL) { + FreePool (TempOptionPtr); + } return Status; } -- 2.39.2