]> git.proxmox.com Git - mirror_edk2.git/commitdiff
add NULL pointer check.
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 12 Feb 2009 01:55:32 +0000 (01:55 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 12 Feb 2009 01:55:32 +0000 (01:55 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7506 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c

index f2e3121513845d62ec6156535a424bad388d4335..0d03376359fb550488f7c6e57e20f15e99d6cb97 100644 (file)
@@ -3,7 +3,7 @@
   Implement all four UEFI Runtime Variable services for the nonvolatile\r
   and volatile storage space and install variable architecture protocol.\r
   \r
-Copyright (c) 2006 - 2008, Intel Corporation                                                         \r
+Copyright (c) 2006 - 2009, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -765,7 +765,9 @@ UpdateVariableCache (
   UINTN                     Index;\r
 \r
   if (EfiAtRuntime ()) {\r
+    //\r
     // Don't use the cache at runtime\r
+    // \r
     return;\r
   }\r
 \r
@@ -774,7 +776,9 @@ UpdateVariableCache (
       if (StrCmp (VariableName, Entry->Name) == 0) { \r
         Entry->Attributes = Attributes;\r
         if (DataSize == 0) {\r
+          //\r
           // Delete Case\r
+          //\r
           if (Entry->DataSize != 0) {\r
             FreePool (Entry->Data);\r
           }\r
@@ -783,6 +787,8 @@ UpdateVariableCache (
           CopyMem (Entry->Data, Data, DataSize);\r
         } else {\r
           Entry->Data = AllocatePool (DataSize);\r
+          ASSERT (Entry->Data != NULL);\r
+\r
           Entry->DataSize = DataSize;\r
           CopyMem (Entry->Data, Data, DataSize);\r
         }\r