]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg HiiDataBase: Fix the potential NULL pointer reference
authorLiming Gao <liming.gao@intel.com>
Wed, 27 Dec 2017 02:31:19 +0000 (10:31 +0800)
committerLiming Gao <liming.gao@intel.com>
Wed, 27 Dec 2017 09:40:45 +0000 (17:40 +0800)
This change is the additional fix of commit
14b351e2ed8586f144dd3cd2e0a25082c1a32837.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Universal/HiiDatabaseDxe/Database.c

index c10134b8e67712fd2fe8279254ecb4ccfdff0127..4a2dc8d0304399810344f05b5d246a57f5f3d66b 100644 (file)
@@ -845,7 +845,7 @@ UpdateDefaultSettingInFormPackage (
         //\r
         EfiVarStoreList   = ReallocatePool (EfiVarStoreMaxNum * sizeof (UINTN), (EfiVarStoreMaxNum + BASE_NUMBER) * sizeof (UINTN), EfiVarStoreList);\r
         if (EfiVarStoreList == NULL) {\r
         //\r
         EfiVarStoreList   = ReallocatePool (EfiVarStoreMaxNum * sizeof (UINTN), (EfiVarStoreMaxNum + BASE_NUMBER) * sizeof (UINTN), EfiVarStoreList);\r
         if (EfiVarStoreList == NULL) {\r
-          break;\r
+          goto Done;\r
         }\r
         EfiVarStoreMaxNum = EfiVarStoreMaxNum + BASE_NUMBER;\r
       }\r
         }\r
         EfiVarStoreMaxNum = EfiVarStoreMaxNum + BASE_NUMBER;\r
       }\r
@@ -874,7 +874,7 @@ UpdateDefaultSettingInFormPackage (
         //\r
         DefaultIdList   = ReallocatePool (DefaultIdMaxNum * sizeof (UINT16), (DefaultIdMaxNum + BASE_NUMBER) * sizeof (UINT16), DefaultIdList);\r
         if (DefaultIdList == NULL) {\r
         //\r
         DefaultIdList   = ReallocatePool (DefaultIdMaxNum * sizeof (UINT16), (DefaultIdMaxNum + BASE_NUMBER) * sizeof (UINT16), DefaultIdList);\r
         if (DefaultIdList == NULL) {\r
-          break;\r
+          goto Done;\r
         }\r
         DefaultIdMaxNum = DefaultIdMaxNum + BASE_NUMBER;\r
       }\r
         }\r
         DefaultIdMaxNum = DefaultIdMaxNum + BASE_NUMBER;\r
       }\r
@@ -1046,8 +1046,10 @@ UpdateDefaultSettingInFormPackage (
   }\r
 \r
 Done:\r
   }\r
 \r
 Done:\r
-  for (Index = 0; Index < EfiVarStoreNumber; Index ++) {\r
-    FreePool (EfiVarStoreList [Index]);\r
+  if (EfiVarStoreList != NULL) {\r
+    for (Index = 0; Index < EfiVarStoreNumber; Index ++) {\r
+      FreePool (EfiVarStoreList [Index]);\r
+    }\r
   }\r
   return;\r
 }\r
   }\r
   return;\r
 }\r