ShellPkg/UefiShellLib: Set input pointer parameter to null if failure

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1906

While failed to allocate memory to save the response,
set the input/output parameter 'Response'(VOID **) to
NULL to indicate the failure not only depend on the
returned status.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Bret Barkelew 2019-06-12 14:04:57 +08:00 committed by Jaben Carsey
parent 6a1f06fadb
commit 21902410ad
1 changed files with 5 additions and 0 deletions

View File

@ -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) {