summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-12 01:55:32 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-12 01:55:32 +0000
commit892b7f90c5a2abd2e88e1f5787d9e6dad9f8fab5 (patch)
tree5a132f7a2a035a8235ffd7b4f5a58482709d24eb
parent68443c61b4e51bdef20a60692bf1c417c5e06fb8 (diff)
downloadedk2-platforms-892b7f90c5a2abd2e88e1f5787d9e6dad9f8fab5.tar.xz
add NULL pointer check.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7506 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index f2e3121513..0d03376359 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -3,7 +3,7 @@
Implement all four UEFI Runtime Variable services for the nonvolatile
and volatile storage space and install variable architecture protocol.
-Copyright (c) 2006 - 2008, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -765,7 +765,9 @@ UpdateVariableCache (
UINTN Index;
if (EfiAtRuntime ()) {
+ //
// Don't use the cache at runtime
+ //
return;
}
@@ -774,7 +776,9 @@ UpdateVariableCache (
if (StrCmp (VariableName, Entry->Name) == 0) {
Entry->Attributes = Attributes;
if (DataSize == 0) {
+ //
// Delete Case
+ //
if (Entry->DataSize != 0) {
FreePool (Entry->Data);
}
@@ -783,6 +787,8 @@ UpdateVariableCache (
CopyMem (Entry->Data, Data, DataSize);
} else {
Entry->Data = AllocatePool (DataSize);
+ ASSERT (Entry->Data != NULL);
+
Entry->DataSize = DataSize;
CopyMem (Entry->Data, Data, DataSize);
}