Reviewed-by: Ray Ni <ray...@intel.com> > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > Gao, Zhichao > Sent: Wednesday, June 12, 2019 2:14 PM > To: devel@edk2.groups.io > Cc: Bret Barkelew <bret.barke...@microsoft.com>; Carsey, Jaben > <jaben.car...@intel.com>; Ni, Ray <ray...@intel.com>; Gao, Liming > <liming....@intel.com>; Sean Brogan <sean.bro...@microsoft.com>; > Michael Turner <michael.tur...@microsoft.com> > Subject: [edk2-devel] [PATCH] ShellPkg/UefiShellLib: Set input pointer > parameter to null if failure > > From: Bret Barkelew <bret.barke...@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.car...@intel.com> > Cc: Ray Ni <ray...@intel.com> > Cc: Liming Gao <liming....@intel.com> > Cc: Sean Brogan <sean.bro...@microsoft.com> > Cc: Michael Turner <michael.tur...@microsoft.com> > Cc: Bret Barkelew <bret.barke...@microsoft.com> > Signed-off-by: Zhichao Gao <zhichao....@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_RESP > ONSE)); > 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 > > >
-=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#42911): https://edk2.groups.io/g/devel/message/42911 Mute This Topic: https://groups.io/mt/32038420/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-