mirror of https://github.com/acidanthera/audk.git
add NULL pointer check.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7506 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
68443c61b4
commit
892b7f90c5
|
@ -3,7 +3,7 @@
|
||||||
Implement all four UEFI Runtime Variable services for the nonvolatile
|
Implement all four UEFI Runtime Variable services for the nonvolatile
|
||||||
and volatile storage space and install variable architecture protocol.
|
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
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -765,7 +765,9 @@ UpdateVariableCache (
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
if (EfiAtRuntime ()) {
|
if (EfiAtRuntime ()) {
|
||||||
|
//
|
||||||
// Don't use the cache at runtime
|
// Don't use the cache at runtime
|
||||||
|
//
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -774,7 +776,9 @@ UpdateVariableCache (
|
||||||
if (StrCmp (VariableName, Entry->Name) == 0) {
|
if (StrCmp (VariableName, Entry->Name) == 0) {
|
||||||
Entry->Attributes = Attributes;
|
Entry->Attributes = Attributes;
|
||||||
if (DataSize == 0) {
|
if (DataSize == 0) {
|
||||||
|
//
|
||||||
// Delete Case
|
// Delete Case
|
||||||
|
//
|
||||||
if (Entry->DataSize != 0) {
|
if (Entry->DataSize != 0) {
|
||||||
FreePool (Entry->Data);
|
FreePool (Entry->Data);
|
||||||
}
|
}
|
||||||
|
@ -783,6 +787,8 @@ UpdateVariableCache (
|
||||||
CopyMem (Entry->Data, Data, DataSize);
|
CopyMem (Entry->Data, Data, DataSize);
|
||||||
} else {
|
} else {
|
||||||
Entry->Data = AllocatePool (DataSize);
|
Entry->Data = AllocatePool (DataSize);
|
||||||
|
ASSERT (Entry->Data != NULL);
|
||||||
|
|
||||||
Entry->DataSize = DataSize;
|
Entry->DataSize = DataSize;
|
||||||
CopyMem (Entry->Data, Data, DataSize);
|
CopyMem (Entry->Data, Data, DataSize);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue