* [PATCH] ShellPkg/UefiShellLib: Set input pointer parameter to null if failure
@ 2019-06-12 6:13 Gao, Zhichao
0 siblings, 0 replies; only message in thread
From: Gao, Zhichao @ 2019-06-12 6:13 UTC (permalink / raw)
To: devel
Cc: Bret Barkelew, Jaben Carsey, Ray Ni, Liming Gao, Sean Brogan,
Michael Turner
From: Bret Barkelew <Bret.Barkelew@microsoft.com>
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>
---
ShellPkg/Library/UefiShellLib/UefiShellLib.c | 5 +++++
1 file changed, 5 insertions(+)
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) {
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-06-12 6:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-12 6:13 [PATCH] ShellPkg/UefiShellLib: Set input pointer parameter to null if failure Gao, Zhichao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox