summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c')
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c
index 8d26c9d93..7c3aa542b 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c
@@ -176,7 +176,9 @@ ShellCommandRunSetVar (
if (Status == EFI_BUFFER_TOO_SMALL) {
Buffer = AllocateZeroPool(Size);
Status = gRT->GetVariable((CHAR16*)VariableName, &Guid, &Attributes2, &Size, Buffer);
- FreePool(Buffer);
+ if (Buffer != NULL) {
+ FreePool(Buffer);
+ }
Attributes = Attributes2;
}
//