mirror of https://github.com/acidanthera/audk.git
ShellPkg: Handle pool allocation failure
If AllocateZeroPool() returns NULL, GetVariable() will return EFI_BUFFER_TOO_SMALL, FreePool() will receive NULL. So check for NULL before FreePool(). Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Sergei Antonov <saproj@gmail.com> Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14688 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
c1d932429e
commit
6b6aa6d136
|
@ -176,7 +176,9 @@ ShellCommandRunSetVar (
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
Buffer = AllocateZeroPool(Size);
|
Buffer = AllocateZeroPool(Size);
|
||||||
Status = gRT->GetVariable((CHAR16*)VariableName, &Guid, &Attributes2, &Size, Buffer);
|
Status = gRT->GetVariable((CHAR16*)VariableName, &Guid, &Attributes2, &Size, Buffer);
|
||||||
FreePool(Buffer);
|
if (Buffer != NULL) {
|
||||||
|
FreePool(Buffer);
|
||||||
|
}
|
||||||
Attributes = Attributes2;
|
Attributes = Attributes2;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue