From 892b7f90c5a2abd2e88e1f5787d9e6dad9f8fab5 Mon Sep 17 00:00:00 2001 From: vanjeff Date: Thu, 12 Feb 2009 01:55:32 +0000 Subject: [PATCH] add NULL pointer check. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7506 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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); } -- 2.39.2