Re: [edk2-devel] [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue
Hi Abner, Thank you for your reviewing, here is the link to the PR. https://github.com/tianocore/edk2/pull/2612 Regards Wenyi On 2022/3/11 15:03, Chang, Abner (HPS SW/FW Technologist) wrote: > Hi Wenyi, > Please add my RB in the commit message and create the PR against edk2, let me > know the link to PR as well. > > Thanks, > Abner > -- > *From:* Chang, Abner (HPS SW/FW Technologist) > *Sent:* Friday, March 11, 2022 1:48 PM > *To:* Wenyi Xie ; devel@edk2.groups.io > ; Wang, Nickle (Server BIOS) > *Cc:* songdongku...@huawei.com > *Subject:* RE: [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue > > Thanks for catching this. > > Reviewed-by: Abner Chang > >> -Original Message- >> From: Wenyi Xie >> Sent: Thursday, March 10, 2022 7:26 PM >> To: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist) >> ; Wang, Nickle (Server BIOS) >> >> Cc: songdongku...@huawei.com; xiewen...@huawei.com >> Subject: [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue >> >> The calloc memory is not free when function collectionEvalOp >> return in the halfway. >> >> Cc: Abner Chang >> Cc: Nickle Wang >> Signed-off-by: Wenyi Xie >> --- >> RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c | 16 >> +++- >> 1 file changed, 7 insertions(+), 9 deletions(-) >> >> diff --git >> a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c >> b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c >> index 3f2b83e834d0..6c6e2246abe3 100644 >> --- a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c >> +++ b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c >> @@ -620,6 +620,7 @@ collectionEvalOp ( >> if (((*StatusCode == NULL) && (members == NULL)) || >> ((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) || >> (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT >> { >> + free (valid); >> return members; >> } >> >> @@ -633,6 +634,7 @@ collectionEvalOp ( >> if (((*StatusCode == NULL) && (tmp == NULL)) || >> ((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) || >> (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT >> { >> + free (valid); >> return tmp; >> } >> >> @@ -658,19 +660,15 @@ collectionEvalOp ( >> >> cleanupPayload (members); >> if (validCount == 0) { >> - free (valid); >> - return NULL; >> - } >> - >> - if (validCount == 1) { >> + ret = NULL; >> + } else if (validCount == 1) { >> ret = valid[0]; >> - free (valid); >> - return ret; >> } else { >> ret = createCollection (payload->service, validCount, valid); >> - free (valid); >> - return ret; >> } >> + >> + free (valid); >> + return ret; >> } >> >> static redfishPayload * >> -- >> 2.20.1.windows.1 > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87461): https://edk2.groups.io/g/devel/message/87461 Mute This Topic: https://groups.io/mt/89683950/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue
Hi Wenyi, Please add my RB in the commit message and create the PR against edk2, let me know the link to PR as well. Thanks, Abner From: Chang, Abner (HPS SW/FW Technologist) Sent: Friday, March 11, 2022 1:48 PM To: Wenyi Xie ; devel@edk2.groups.io ; Wang, Nickle (Server BIOS) Cc: songdongku...@huawei.com Subject: RE: [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue Thanks for catching this. Reviewed-by: Abner Chang > -Original Message- > From: Wenyi Xie > Sent: Thursday, March 10, 2022 7:26 PM > To: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist) > ; Wang, Nickle (Server BIOS) > > Cc: songdongku...@huawei.com; xiewen...@huawei.com > Subject: [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue > > The calloc memory is not free when function collectionEvalOp > return in the halfway. > > Cc: Abner Chang > Cc: Nickle Wang > Signed-off-by: Wenyi Xie > --- > RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c | 16 > +++- > 1 file changed, 7 insertions(+), 9 deletions(-) > > diff --git > a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c > b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c > index 3f2b83e834d0..6c6e2246abe3 100644 > --- a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c > +++ b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c > @@ -620,6 +620,7 @@ collectionEvalOp ( >if (((*StatusCode == NULL) && (members == NULL)) || >((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) || > (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT >{ > +free (valid); > return members; >} > > @@ -633,6 +634,7 @@ collectionEvalOp ( > if (((*StatusCode == NULL) && (tmp == NULL)) || > ((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) || > (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT > { > + free (valid); >return tmp; > } > > @@ -658,19 +660,15 @@ collectionEvalOp ( > >cleanupPayload (members); >if (validCount == 0) { > -free (valid); > -return NULL; > - } > - > - if (validCount == 1) { > +ret = NULL; > + } else if (validCount == 1) { > ret = valid[0]; > -free (valid); > -return ret; >} else { > ret = createCollection (payload->service, validCount, valid); > -free (valid); > -return ret; >} > + > + free (valid); > + return ret; > } > > static redfishPayload * > -- > 2.20.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87455): https://edk2.groups.io/g/devel/message/87455 Mute This Topic: https://groups.io/mt/89683950/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue
Thanks for catching this. Reviewed-by: Abner Chang > -Original Message- > From: Wenyi Xie > Sent: Thursday, March 10, 2022 7:26 PM > To: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist) > ; Wang, Nickle (Server BIOS) > > Cc: songdongku...@huawei.com; xiewen...@huawei.com > Subject: [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue > > The calloc memory is not free when function collectionEvalOp > return in the halfway. > > Cc: Abner Chang > Cc: Nickle Wang > Signed-off-by: Wenyi Xie > --- > RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c | 16 > +++- > 1 file changed, 7 insertions(+), 9 deletions(-) > > diff --git > a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c > b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c > index 3f2b83e834d0..6c6e2246abe3 100644 > --- a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c > +++ b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c > @@ -620,6 +620,7 @@ collectionEvalOp ( >if (((*StatusCode == NULL) && (members == NULL)) || >((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) || > (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT >{ > +free (valid); > return members; >} > > @@ -633,6 +634,7 @@ collectionEvalOp ( > if (((*StatusCode == NULL) && (tmp == NULL)) || > ((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) || > (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT > { > + free (valid); >return tmp; > } > > @@ -658,19 +660,15 @@ collectionEvalOp ( > >cleanupPayload (members); >if (validCount == 0) { > -free (valid); > -return NULL; > - } > - > - if (validCount == 1) { > +ret = NULL; > + } else if (validCount == 1) { > ret = valid[0]; > -free (valid); > -return ret; >} else { > ret = createCollection (payload->service, validCount, valid); > -free (valid); > -return ret; >} > + > + free (valid); > + return ret; > } > > static redfishPayload * > -- > 2.20.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87451): https://edk2.groups.io/g/devel/message/87451 Mute This Topic: https://groups.io/mt/89683950/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue
The calloc memory is not free when function collectionEvalOp return in the halfway. Cc: Abner Chang Cc: Nickle Wang Signed-off-by: Wenyi Xie --- RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c index 3f2b83e834d0..6c6e2246abe3 100644 --- a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c +++ b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c @@ -620,6 +620,7 @@ collectionEvalOp ( if (((*StatusCode == NULL) && (members == NULL)) || ((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) || (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT { +free (valid); return members; } @@ -633,6 +634,7 @@ collectionEvalOp ( if (((*StatusCode == NULL) && (tmp == NULL)) || ((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) || (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT { + free (valid); return tmp; } @@ -658,19 +660,15 @@ collectionEvalOp ( cleanupPayload (members); if (validCount == 0) { -free (valid); -return NULL; - } - - if (validCount == 1) { +ret = NULL; + } else if (validCount == 1) { ret = valid[0]; -free (valid); -return ret; } else { ret = createCollection (payload->service, validCount, valid); -free (valid); -return ret; } + + free (valid); + return ret; } static redfishPayload * -- 2.20.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87404): https://edk2.groups.io/g/devel/message/87404 Mute This Topic: https://groups.io/mt/89683950/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-