summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c')
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
index afeedb0959..b02048302e 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
@@ -121,11 +121,15 @@ CascadeProcessVariables (
if (Status == EFI_BUFFER_TOO_SMALL) {
SHELL_FREE_NON_NULL(FoundVarName);
FoundVarName = AllocateZeroPool (NameSize);
- if (PrevName != NULL) {
- StrCpy(FoundVarName, PrevName);
- }
+ if (FoundVarName != NULL) {
+ if (PrevName != NULL) {
+ StrCpy(FoundVarName, PrevName);
+ }
- Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid);
+ Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid);
+ } else {
+ Status = EFI_OUT_OF_RESOURCES;
+ }
}
//