From d8dc9f0af56c68492d8a1be52efc1a711d3497f4 Mon Sep 17 00:00:00 2001 From: Olivier Martin Date: Wed, 2 Apr 2014 17:32:29 +0000 Subject: ArmPkg: Fixed GetEnvironmentVariable() when the UEFI Variable did not exist The function was allocating a buffer for the read value from the UEFI Variable. But it was returning the pointer of the default value when the variable was not present. It could cause error when the default value and the returned value were free when these addresses were the same (double FreePool on the same address). Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15427 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPkg/Library/BdsLib/BdsHelper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ArmPkg/Library') diff --git a/ArmPkg/Library/BdsLib/BdsHelper.c b/ArmPkg/Library/BdsLib/BdsHelper.c index fb2ac9b806..1d4aa35728 100644 --- a/ArmPkg/Library/BdsLib/BdsHelper.c +++ b/ArmPkg/Library/BdsLib/BdsHelper.c @@ -331,7 +331,7 @@ GetEnvironmentVariable ( *Size, DefaultValue ); - *Value = DefaultValue; + *Value = AllocateCopyPool (*Size, DefaultValue); } else { return EFI_NOT_FOUND; } @@ -352,7 +352,7 @@ GetEnvironmentVariable ( *Size = VariableSize; } } else { - *Value = DefaultValue; + *Value = AllocateCopyPool (*Size, DefaultValue); return Status; } -- cgit v1.2.3