MdeModulePkg/Universal/HiiDatabaseDxe/Database.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
---
MdeModulePkg/Universal/HiiDatabaseDxe/Database.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
index 4a2dc8d030..e8f4564e64 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
@@ -721,9 +721,14 @@ FindQuestionDefaultSetting (
VariableStorage = NULL;
}
Entry = AllocatePool (sizeof (VARSTORAGE_DEFAULT_DATA));
- Entry->DefaultId = DefaultId;
- Entry->VariableStorage = VariableStorage;
- InsertTailList (&gVarStorageList, &Entry->Entry);
+ if (Entry != NULL) {
+ Entry->DefaultId = DefaultId;
+ Entry->VariableStorage = VariableStorage;
+ InsertTailList (&gVarStorageList, &Entry->Entry);
+ } else if (VariableStorage != NULL) {
+ FreePool (VariableStorage);
+ VariableStorage = NULL;
+ }
}
//
// The matched variable storage is not found.
--
2.11.0.windows.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Reviewed-by: Star Zeng <star.zeng@intel.com> Thanks, Star -----Original Message----- From: Gao, Liming Sent: Thursday, December 28, 2017 12:54 PM To: edk2-devel@lists.01.org Cc: Zeng, Star <star.zeng@intel.com> Subject: [Patch] MdeModulePkg HiiDataBase: Fix the potential NULL pointer access Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Star Zeng <star.zeng@intel.com> --- MdeModulePkg/Universal/HiiDatabaseDxe/Database.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c index 4a2dc8d030..e8f4564e64 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c @@ -721,9 +721,14 @@ FindQuestionDefaultSetting ( VariableStorage = NULL; } Entry = AllocatePool (sizeof (VARSTORAGE_DEFAULT_DATA)); - Entry->DefaultId = DefaultId; - Entry->VariableStorage = VariableStorage; - InsertTailList (&gVarStorageList, &Entry->Entry); + if (Entry != NULL) { + Entry->DefaultId = DefaultId; + Entry->VariableStorage = VariableStorage; + InsertTailList (&gVarStorageList, &Entry->Entry); + } else if (VariableStorage != NULL) { + FreePool (VariableStorage); + VariableStorage = NULL; + } } // // The matched variable storage is not found. -- 2.11.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2024 Red Hat, Inc.