summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Library/GenericBdsLib/BdsMisc.c12
1 files 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;
}