diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c index 430b20e127..5be530092e 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -3366,6 +3366,9 @@ ShellPromptForResponse ( if (Type != ShellPromptResponseTypeFreeform) { Resp = (SHELL_PROMPT_RESPONSE*)AllocateZeroPool(sizeof(SHELL_PROMPT_RESPONSE)); if (Resp == NULL) { + if (Response != NULL) { + *Response = NULL; + } return (EFI_OUT_OF_RESOURCES); } } @@ -3568,6 +3571,8 @@ ShellPromptForResponse ( *Response = Resp; } else if (Buffer != NULL) { *Response = Buffer; + } else { + *Response = NULL; } } else { if (Resp != NULL) {