add condition judgment to avoid accessing NULL address if not found existing variable.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9038 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
eric_tian 2009-08-11 05:24:12 +00:00
parent 6844f1882f
commit 1d5b25b715
1 changed files with 4 additions and 2 deletions

View File

@ -618,7 +618,7 @@ UpdateVariable (
UINTN VarDataOffset;
UINTN VarSize;
VARIABLE_GLOBAL *Global;
UINTN NonVolatileVarableStoreSize;
UINTN NonVolatileVarableStoreSize;
Global = &mVariableModuleGlobal->VariableGlobal[Physical];
@ -767,7 +767,9 @@ UpdateVariable (
//
// Mark the old variable as deleted
//
Variable->CurrPtr->State &= VAR_DELETED;
if (Variable->CurrPtr != NULL) {
Variable->CurrPtr->State &= VAR_DELETED;
}
UpdateVariableInfo (VariableName, VendorGuid, Variable->Volatile, FALSE, TRUE, FALSE, FALSE);