* [edk2-devel] [edk2-redfish-client][PATCH 0/2] RedfishClientPkg: fix memory leak in ConverterLib
@ 2024-01-27 0:01 Mike Maslenkin
2024-01-27 0:01 ` [edk2-devel] [edk2-redfish-client][PATCH 1/2] RedfishClientPkg: fix uninitialized variable build error Mike Maslenkin
2024-01-27 0:01 ` [edk2-devel] [edk2-redfish-client][PATCH 2/2] RedfishClientPkg: fix memory leak in ConverterLib Mike Maslenkin
0 siblings, 2 replies; 7+ messages in thread
From: Mike Maslenkin @ 2024-01-27 0:01 UTC (permalink / raw)
To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin
This patchset contains a trivial fix for memory leak in ConverterLib
Also patch 1 is a resend of the same patch sent to list on 4th Jan with
added Rb (https://edk2.groups.io/g/devel/message/113162).
PR: https://github.com/tianocore/edk2-redfish-client/pull/74
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114643): https://edk2.groups.io/g/devel/message/114643
Mute This Topic: https://groups.io/mt/103988338/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 7+ messages in thread
* [edk2-devel] [edk2-redfish-client][PATCH 1/2] RedfishClientPkg: fix uninitialized variable build error
2024-01-27 0:01 [edk2-devel] [edk2-redfish-client][PATCH 0/2] RedfishClientPkg: fix memory leak in ConverterLib Mike Maslenkin
@ 2024-01-27 0:01 ` Mike Maslenkin
2024-01-27 0:01 ` [edk2-devel] [edk2-redfish-client][PATCH 2/2] RedfishClientPkg: fix memory leak in ConverterLib Mike Maslenkin
1 sibling, 0 replies; 7+ messages in thread
From: Mike Maslenkin @ 2024-01-27 0:01 UTC (permalink / raw)
To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin
Variable 'Status' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
---
RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
index dce83a8a986f..e76f8d106987 100644
--- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
+++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
@@ -152,6 +152,7 @@ StartUpFeatureDriver (
}
ThisList = ThisFeatureDriverList;
+ Status = EFI_SUCCESS;
while (TRUE) {
if (ThisList->Callback != NULL) {
ThisList->InformationExchange = mInformationExchange;
--
2.32.0 (Apple Git-132)
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114644): https://edk2.groups.io/g/devel/message/114644
Mute This Topic: https://groups.io/mt/103988339/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [edk2-devel] [edk2-redfish-client][PATCH 2/2] RedfishClientPkg: fix memory leak in ConverterLib
2024-01-27 0:01 [edk2-devel] [edk2-redfish-client][PATCH 0/2] RedfishClientPkg: fix memory leak in ConverterLib Mike Maslenkin
2024-01-27 0:01 ` [edk2-devel] [edk2-redfish-client][PATCH 1/2] RedfishClientPkg: fix uninitialized variable build error Mike Maslenkin
@ 2024-01-27 0:01 ` Mike Maslenkin
2024-01-29 2:41 ` Chang, Abner via groups.io
1 sibling, 1 reply; 7+ messages in thread
From: Mike Maslenkin @ 2024-01-27 0:01 UTC (permalink / raw)
To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin
The memory returned by json_dumps() must be freed.
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
---
RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
index 126200dd019c..250ef75e40de 100644
--- a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
+++ b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
@@ -379,15 +379,19 @@ CreateCsJsonByNode (
if (TempChar != NULL) {
Status = allocateRecordCsMemory (Cs, sizeof (RedfishCS_Type_JSON_Data), (void **)&CsTypeJson);
if (Status != RedfishCS_status_success) {
+ free (TempChar);
return Status;
}
Status = allocateRecordCsMemory (Cs, (RedfishCS_int)strlen (TempChar) + 1, (void **)&DumpStr);
if (Status != RedfishCS_status_success) {
+ free (TempChar);
return Status;
}
strncpy (DumpStr, TempChar, strlen (TempChar) + 1);
+ free (TempChar);
+
InitializeLinkHead (&CsTypeJson->Header.LinkEntry);
CsTypeJson->Header.ResourceType = RedfishCS_Type_JSON;
CsTypeJson->Header.ThisUri = ParentUri;
@@ -1506,9 +1510,10 @@ RemoveUnchangeableProperties (
Status = RedfishCS_status_insufficient_memory;
} else {
memcpy (NewJsonBuffer, TempChar, strlen (TempChar) + 1);
- free (TempChar);
Status = RedfishCS_status_success;
}
+
+ free (TempChar);
} else {
Status = RedfishCS_status_unknown_error;
}
--
2.32.0 (Apple Git-132)
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114645): https://edk2.groups.io/g/devel/message/114645
Mute This Topic: https://groups.io/mt/103988340/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [edk2-redfish-client][PATCH 2/2] RedfishClientPkg: fix memory leak in ConverterLib
2024-01-27 0:01 ` [edk2-devel] [edk2-redfish-client][PATCH 2/2] RedfishClientPkg: fix memory leak in ConverterLib Mike Maslenkin
@ 2024-01-29 2:41 ` Chang, Abner via groups.io
2024-01-30 11:14 ` Mike Maslenkin
0 siblings, 1 reply; 7+ messages in thread
From: Chang, Abner via groups.io @ 2024-01-29 2:41 UTC (permalink / raw)
To: Mike Maslenkin, devel@edk2.groups.io; +Cc: nicklew@nvidia.com, igork@ami.com
[AMD Official Use Only - General]
Reviewed-by: Abner Chang <abner.chang@amd.com>
Would you like to create a PR on below repo https://github.com/DMTF/Redfish-Schema-C-Struct-Generator for the 2/2 patch? As we should fix the issue on DMTF Github as well. RedfishCsCommon.c is here, https://github.com/DMTF/Redfish-Schema-C-Struct-Generator/tree/main/src. I can also help to sync up the fix if you are ok with it.
Thanks
Abner
> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Saturday, January 27, 2024 8:01 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; nicklew@nvidia.com;
> igork@ami.com; Mike Maslenkin <mike.maslenkin@gmail.com>
> Subject: [edk2-redfish-client][PATCH 2/2] RedfishClientPkg: fix memory leak in
> ConverterLib
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> The memory returned by json_dumps() must be freed.
>
> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> ---
> RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> index 126200dd019c..250ef75e40de 100644
> --- a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> +++ b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> @@ -379,15 +379,19 @@ CreateCsJsonByNode (
> if (TempChar != NULL) {
>
> Status = allocateRecordCsMemory (Cs, sizeof
> (RedfishCS_Type_JSON_Data), (void **)&CsTypeJson);
>
> if (Status != RedfishCS_status_success) {
>
> + free (TempChar);
>
> return Status;
>
> }
>
>
>
> Status = allocateRecordCsMemory (Cs, (RedfishCS_int)strlen (TempChar) +
> 1, (void **)&DumpStr);
>
> if (Status != RedfishCS_status_success) {
>
> + free (TempChar);
>
> return Status;
>
> }
>
>
>
> strncpy (DumpStr, TempChar, strlen (TempChar) + 1);
>
> + free (TempChar);
>
> +
>
> InitializeLinkHead (&CsTypeJson->Header.LinkEntry);
>
> CsTypeJson->Header.ResourceType = RedfishCS_Type_JSON;
>
> CsTypeJson->Header.ThisUri = ParentUri;
>
> @@ -1506,9 +1510,10 @@ RemoveUnchangeableProperties (
> Status = RedfishCS_status_insufficient_memory;
>
> } else {
>
> memcpy (NewJsonBuffer, TempChar, strlen (TempChar) + 1);
>
> - free (TempChar);
>
> Status = RedfishCS_status_success;
>
> }
>
> +
>
> + free (TempChar);
>
> } else {
>
> Status = RedfishCS_status_unknown_error;
>
> }
>
> --
> 2.32.0 (Apple Git-132)
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114665): https://edk2.groups.io/g/devel/message/114665
Mute This Topic: https://groups.io/mt/103988340/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [edk2-redfish-client][PATCH 2/2] RedfishClientPkg: fix memory leak in ConverterLib
2024-01-29 2:41 ` Chang, Abner via groups.io
@ 2024-01-30 11:14 ` Mike Maslenkin
2024-01-30 14:06 ` Chang, Abner via groups.io
[not found] ` <17AF251A16C0A480.16647@groups.io>
0 siblings, 2 replies; 7+ messages in thread
From: Mike Maslenkin @ 2024-01-30 11:14 UTC (permalink / raw)
To: Chang, Abner; +Cc: devel@edk2.groups.io, nicklew@nvidia.com, igork@ami.com
Hi Abner,
I created PR containing patch 2/2 with your R-b set.
https://github.com/DMTF/Redfish-Schema-C-Struct-Generator/pull/5
Please review and commit. Thank you!
Regards,
Mike.
On Mon, Jan 29, 2024 at 5:41 AM Chang, Abner <Abner.Chang@amd.com> wrote:
>
> [AMD Official Use Only - General]
>
> Reviewed-by: Abner Chang <abner.chang@amd.com>
>
> Would you like to create a PR on below repo https://github.com/DMTF/Redfish-Schema-C-Struct-Generator for the 2/2 patch? As we should fix the issue on DMTF Github as well. RedfishCsCommon.c is here, https://github.com/DMTF/Redfish-Schema-C-Struct-Generator/tree/main/src. I can also help to sync up the fix if you are ok with it.
>
> Thanks
> Abner
>
>
> > -----Original Message-----
> > From: Mike Maslenkin <mike.maslenkin@gmail.com>
> > Sent: Saturday, January 27, 2024 8:01 AM
> > To: devel@edk2.groups.io
> > Cc: Chang, Abner <Abner.Chang@amd.com>; nicklew@nvidia.com;
> > igork@ami.com; Mike Maslenkin <mike.maslenkin@gmail.com>
> > Subject: [edk2-redfish-client][PATCH 2/2] RedfishClientPkg: fix memory leak in
> > ConverterLib
> >
> > Caution: This message originated from an External Source. Use proper caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > The memory returned by json_dumps() must be freed.
> >
> > Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
> > Cc: Abner Chang <abner.chang@amd.com>
> > Cc: Nickle Wang <nicklew@nvidia.com>
> > Cc: Igor Kulchytskyy <igork@ami.com>
> > ---
> > RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> > b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> > index 126200dd019c..250ef75e40de 100644
> > --- a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> > +++ b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> > @@ -379,15 +379,19 @@ CreateCsJsonByNode (
> > if (TempChar != NULL) {
> >
> > Status = allocateRecordCsMemory (Cs, sizeof
> > (RedfishCS_Type_JSON_Data), (void **)&CsTypeJson);
> >
> > if (Status != RedfishCS_status_success) {
> >
> > + free (TempChar);
> >
> > return Status;
> >
> > }
> >
> >
> >
> > Status = allocateRecordCsMemory (Cs, (RedfishCS_int)strlen (TempChar) +
> > 1, (void **)&DumpStr);
> >
> > if (Status != RedfishCS_status_success) {
> >
> > + free (TempChar);
> >
> > return Status;
> >
> > }
> >
> >
> >
> > strncpy (DumpStr, TempChar, strlen (TempChar) + 1);
> >
> > + free (TempChar);
> >
> > +
> >
> > InitializeLinkHead (&CsTypeJson->Header.LinkEntry);
> >
> > CsTypeJson->Header.ResourceType = RedfishCS_Type_JSON;
> >
> > CsTypeJson->Header.ThisUri = ParentUri;
> >
> > @@ -1506,9 +1510,10 @@ RemoveUnchangeableProperties (
> > Status = RedfishCS_status_insufficient_memory;
> >
> > } else {
> >
> > memcpy (NewJsonBuffer, TempChar, strlen (TempChar) + 1);
> >
> > - free (TempChar);
> >
> > Status = RedfishCS_status_success;
> >
> > }
> >
> > +
> >
> > + free (TempChar);
> >
> > } else {
> >
> > Status = RedfishCS_status_unknown_error;
> >
> > }
> >
> > --
> > 2.32.0 (Apple Git-132)
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114770): https://edk2.groups.io/g/devel/message/114770
Mute This Topic: https://groups.io/mt/103988340/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [edk2-redfish-client][PATCH 2/2] RedfishClientPkg: fix memory leak in ConverterLib
2024-01-30 11:14 ` Mike Maslenkin
@ 2024-01-30 14:06 ` Chang, Abner via groups.io
[not found] ` <17AF251A16C0A480.16647@groups.io>
1 sibling, 0 replies; 7+ messages in thread
From: Chang, Abner via groups.io @ 2024-01-30 14:06 UTC (permalink / raw)
To: Mike Maslenkin; +Cc: devel@edk2.groups.io, nicklew@nvidia.com, igork@ami.com
[AMD Official Use Only - General]
Hi Mike,
I just merged it.
Also Reviewed-by: Abner Chang <abner.chang@amd.com> for this two patches set. You can create a PR against edk2-redfish-client, I will merge it once it passes CI.
Thank you
Abner
> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Tuesday, January 30, 2024 7:15 PM
> To: Chang, Abner <Abner.Chang@amd.com>
> Cc: devel@edk2.groups.io; nicklew@nvidia.com; igork@ami.com
> Subject: Re: [edk2-redfish-client][PATCH 2/2] RedfishClientPkg: fix memory
> leak in ConverterLib
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Hi Abner,
>
> I created PR containing patch 2/2 with your R-b set.
>
> https://github.com/DMTF/Redfish-Schema-C-Struct-Generator/pull/5
>
> Please review and commit. Thank you!
>
> Regards,
> Mike.
>
> On Mon, Jan 29, 2024 at 5:41 AM Chang, Abner <Abner.Chang@amd.com>
> wrote:
> >
> > [AMD Official Use Only - General]
> >
> > Reviewed-by: Abner Chang <abner.chang@amd.com>
> >
> > Would you like to create a PR on below repo
> https://github.com/DMTF/Redfish-Schema-C-Struct-Generator for the 2/2
> patch? As we should fix the issue on DMTF Github as well.
> RedfishCsCommon.c is here, https://github.com/DMTF/Redfish-Schema-C-
> Struct-Generator/tree/main/src. I can also help to sync up the fix if you are ok
> with it.
> >
> > Thanks
> > Abner
> >
> >
> > > -----Original Message-----
> > > From: Mike Maslenkin <mike.maslenkin@gmail.com>
> > > Sent: Saturday, January 27, 2024 8:01 AM
> > > To: devel@edk2.groups.io
> > > Cc: Chang, Abner <Abner.Chang@amd.com>; nicklew@nvidia.com;
> > > igork@ami.com; Mike Maslenkin <mike.maslenkin@gmail.com>
> > > Subject: [edk2-redfish-client][PATCH 2/2] RedfishClientPkg: fix memory
> leak in
> > > ConverterLib
> > >
> > > Caution: This message originated from an External Source. Use proper
> caution
> > > when opening attachments, clicking links, or responding.
> > >
> > >
> > > The memory returned by json_dumps() must be freed.
> > >
> > > Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
> > > Cc: Abner Chang <abner.chang@amd.com>
> > > Cc: Nickle Wang <nicklew@nvidia.com>
> > > Cc: Igor Kulchytskyy <igork@ami.com>
> > > ---
> > > RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c | 7 ++++++-
> > > 1 file changed, 6 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> > > b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> > > index 126200dd019c..250ef75e40de 100644
> > > --- a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> > > +++ b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> > > @@ -379,15 +379,19 @@ CreateCsJsonByNode (
> > > if (TempChar != NULL) {
> > >
> > > Status = allocateRecordCsMemory (Cs, sizeof
> > > (RedfishCS_Type_JSON_Data), (void **)&CsTypeJson);
> > >
> > > if (Status != RedfishCS_status_success) {
> > >
> > > + free (TempChar);
> > >
> > > return Status;
> > >
> > > }
> > >
> > >
> > >
> > > Status = allocateRecordCsMemory (Cs, (RedfishCS_int)strlen (TempChar)
> +
> > > 1, (void **)&DumpStr);
> > >
> > > if (Status != RedfishCS_status_success) {
> > >
> > > + free (TempChar);
> > >
> > > return Status;
> > >
> > > }
> > >
> > >
> > >
> > > strncpy (DumpStr, TempChar, strlen (TempChar) + 1);
> > >
> > > + free (TempChar);
> > >
> > > +
> > >
> > > InitializeLinkHead (&CsTypeJson->Header.LinkEntry);
> > >
> > > CsTypeJson->Header.ResourceType = RedfishCS_Type_JSON;
> > >
> > > CsTypeJson->Header.ThisUri = ParentUri;
> > >
> > > @@ -1506,9 +1510,10 @@ RemoveUnchangeableProperties (
> > > Status = RedfishCS_status_insufficient_memory;
> > >
> > > } else {
> > >
> > > memcpy (NewJsonBuffer, TempChar, strlen (TempChar) + 1);
> > >
> > > - free (TempChar);
> > >
> > > Status = RedfishCS_status_success;
> > >
> > > }
> > >
> > > +
> > >
> > > + free (TempChar);
> > >
> > > } else {
> > >
> > > Status = RedfishCS_status_unknown_error;
> > >
> > > }
> > >
> > > --
> > > 2.32.0 (Apple Git-132)
> >
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114786): https://edk2.groups.io/g/devel/message/114786
Mute This Topic: https://groups.io/mt/103988340/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [edk2-redfish-client][PATCH 2/2] RedfishClientPkg: fix memory leak in ConverterLib
[not found] ` <17AF251A16C0A480.16647@groups.io>
@ 2024-01-31 4:42 ` Chang, Abner via groups.io
0 siblings, 0 replies; 7+ messages in thread
From: Chang, Abner via groups.io @ 2024-01-31 4:42 UTC (permalink / raw)
To: devel@edk2.groups.io, Chang, Abner, Mike Maslenkin
Cc: nicklew@nvidia.com, igork@ami.com
[AMD Official Use Only - General]
HI Mike,
I missed the PR you created for this patch set. I already merged it.
Thanks
Abner
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chang,
> Abner via groups.io
> Sent: Tuesday, January 30, 2024 10:06 PM
> To: Mike Maslenkin <mike.maslenkin@gmail.com>
> Cc: devel@edk2.groups.io; nicklew@nvidia.com; igork@ami.com
> Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH 2/2] RedfishClientPkg:
> fix memory leak in ConverterLib
>
> [AMD Official Use Only - General]
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> [AMD Official Use Only - General]
>
> Hi Mike,
> I just merged it.
>
> Also Reviewed-by: Abner Chang <abner.chang@amd.com> for this two
> patches set. You can create a PR against edk2-redfish-client, I will merge it
> once it passes CI.
> Thank you
> Abner
>
> > -----Original Message-----
> > From: Mike Maslenkin <mike.maslenkin@gmail.com>
> > Sent: Tuesday, January 30, 2024 7:15 PM
> > To: Chang, Abner <Abner.Chang@amd.com>
> > Cc: devel@edk2.groups.io; nicklew@nvidia.com; igork@ami.com
> > Subject: Re: [edk2-redfish-client][PATCH 2/2] RedfishClientPkg: fix memory
> > leak in ConverterLib
> >
> > Caution: This message originated from an External Source. Use proper
> caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > Hi Abner,
> >
> > I created PR containing patch 2/2 with your R-b set.
> >
> > https://github.com/DMTF/Redfish-Schema-C-Struct-Generator/pull/5
> >
> > Please review and commit. Thank you!
> >
> > Regards,
> > Mike.
> >
> > On Mon, Jan 29, 2024 at 5:41 AM Chang, Abner <Abner.Chang@amd.com>
> > wrote:
> > >
> > > [AMD Official Use Only - General]
> > >
> > > Reviewed-by: Abner Chang <abner.chang@amd.com>
> > >
> > > Would you like to create a PR on below repo
> > https://github.com/DMTF/Redfish-Schema-C-Struct-Generator for the 2/2
> > patch? As we should fix the issue on DMTF Github as well.
> > RedfishCsCommon.c is here, https://github.com/DMTF/Redfish-Schema-C-
> > Struct-Generator/tree/main/src. I can also help to sync up the fix if you are
> ok
> > with it.
> > >
> > > Thanks
> > > Abner
> > >
> > >
> > > > -----Original Message-----
> > > > From: Mike Maslenkin <mike.maslenkin@gmail.com>
> > > > Sent: Saturday, January 27, 2024 8:01 AM
> > > > To: devel@edk2.groups.io
> > > > Cc: Chang, Abner <Abner.Chang@amd.com>; nicklew@nvidia.com;
> > > > igork@ami.com; Mike Maslenkin <mike.maslenkin@gmail.com>
> > > > Subject: [edk2-redfish-client][PATCH 2/2] RedfishClientPkg: fix memory
> > leak in
> > > > ConverterLib
> > > >
> > > > Caution: This message originated from an External Source. Use proper
> > caution
> > > > when opening attachments, clicking links, or responding.
> > > >
> > > >
> > > > The memory returned by json_dumps() must be freed.
> > > >
> > > > Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
> > > > Cc: Abner Chang <abner.chang@amd.com>
> > > > Cc: Nickle Wang <nicklew@nvidia.com>
> > > > Cc: Igor Kulchytskyy <igork@ami.com>
> > > > ---
> > > > RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c | 7 ++++++-
> > > > 1 file changed, 6 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> > > > b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> > > > index 126200dd019c..250ef75e40de 100644
> > > > --- a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> > > > +++ b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> > > > @@ -379,15 +379,19 @@ CreateCsJsonByNode (
> > > > if (TempChar != NULL) {
> > > >
> > > > Status = allocateRecordCsMemory (Cs, sizeof
> > > > (RedfishCS_Type_JSON_Data), (void **)&CsTypeJson);
> > > >
> > > > if (Status != RedfishCS_status_success) {
> > > >
> > > > + free (TempChar);
> > > >
> > > > return Status;
> > > >
> > > > }
> > > >
> > > >
> > > >
> > > > Status = allocateRecordCsMemory (Cs, (RedfishCS_int)strlen
> (TempChar)
> > +
> > > > 1, (void **)&DumpStr);
> > > >
> > > > if (Status != RedfishCS_status_success) {
> > > >
> > > > + free (TempChar);
> > > >
> > > > return Status;
> > > >
> > > > }
> > > >
> > > >
> > > >
> > > > strncpy (DumpStr, TempChar, strlen (TempChar) + 1);
> > > >
> > > > + free (TempChar);
> > > >
> > > > +
> > > >
> > > > InitializeLinkHead (&CsTypeJson->Header.LinkEntry);
> > > >
> > > > CsTypeJson->Header.ResourceType = RedfishCS_Type_JSON;
> > > >
> > > > CsTypeJson->Header.ThisUri = ParentUri;
> > > >
> > > > @@ -1506,9 +1510,10 @@ RemoveUnchangeableProperties (
> > > > Status = RedfishCS_status_insufficient_memory;
> > > >
> > > > } else {
> > > >
> > > > memcpy (NewJsonBuffer, TempChar, strlen (TempChar) + 1);
> > > >
> > > > - free (TempChar);
> > > >
> > > > Status = RedfishCS_status_success;
> > > >
> > > > }
> > > >
> > > > +
> > > >
> > > > + free (TempChar);
> > > >
> > > > } else {
> > > >
> > > > Status = RedfishCS_status_unknown_error;
> > > >
> > > > }
> > > >
> > > > --
> > > > 2.32.0 (Apple Git-132)
> > >
>
>
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114853): https://edk2.groups.io/g/devel/message/114853
Mute This Topic: https://groups.io/mt/103988340/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-01-31 4:43 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-27 0:01 [edk2-devel] [edk2-redfish-client][PATCH 0/2] RedfishClientPkg: fix memory leak in ConverterLib Mike Maslenkin
2024-01-27 0:01 ` [edk2-devel] [edk2-redfish-client][PATCH 1/2] RedfishClientPkg: fix uninitialized variable build error Mike Maslenkin
2024-01-27 0:01 ` [edk2-devel] [edk2-redfish-client][PATCH 2/2] RedfishClientPkg: fix memory leak in ConverterLib Mike Maslenkin
2024-01-29 2:41 ` Chang, Abner via groups.io
2024-01-30 11:14 ` Mike Maslenkin
2024-01-30 14:06 ` Chang, Abner via groups.io
[not found] ` <17AF251A16C0A480.16647@groups.io>
2024-01-31 4:42 ` Chang, Abner via groups.io
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox