Reviewed-by: Nickle Wang <nick...@nvidia.com>
Regards,
Nickle
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Mike
> Maslenkin via groups.io
> Sent: Sunday, March 10, 2024 6:42 PM
> To: devel@edk2.groups.io
> Cc: Mike Maslenkin <mike.maslen...@gmail.com>; Abner Chang
> <abner.ch...@amd.com>; Igor Kulchytskyy <ig...@ami.com>; Nickle Wang
> <nick...@nvidia.com>
> Subject: [edk2-devel] [PATCH 4/4][edk2-redfish-client] RedfishClientPkg: fix
> memory leak
>
> External email: Use caution opening links or attachments
>
>
> The structure instance retunred by ToStructure() must be deallocated properly.
>
> Cc: Abner Chang <abner.ch...@amd.com>
> Cc: Igor Kulchytskyy <ig...@ami.com>
> Cc: Nickle Wang <nick...@nvidia.com>
> Signed-off-by: Mike Maslenkin <mike.maslen...@gmail.com>
> ---
> .../v1_5_0/RedfishResourceIdentifyLibComputerSystem.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git
> a/RedfishClientPkg/Library/RedfishResourceIdentifyLibComputerSystem/v1_5_0/
> RedfishResourceIdentifyLibComputerSystem.c
> b/RedfishClientPkg/Library/RedfishResourceIdentifyLibComputerSystem/v1_5_0/
> RedfishResourceIdentifyLibComputerSystem.c
> index 29b4f525d5ff..2f177b8032cc 100644
> ---
> a/RedfishClientPkg/Library/RedfishResourceIdentifyLibComputerSystem/v1_5_0/
> RedfishResourceIdentifyLibComputerSystem.c
> +++ b/RedfishClientPkg/Library/RedfishResourceIdentifyLibComputerSystem/
> +++ v1_5_0/RedfishResourceIdentifyLibComputerSystem.c
> @@ -70,19 +70,20 @@ RedfishIdentifyResource (
> ComputerSystemCs = ComputerSystem->ComputerSystem;
>
>
>
> if (IS_EMPTY_STRING (ComputerSystemCs->UUID)) {
>
> - return FALSE;
>
> + Status = EFI_NOT_FOUND;
>
> + goto ON_RELEASE;
>
> }
>
>
>
> Status = AsciiStrToGuid (ComputerSystemCs->UUID, &ResourceUuid);
>
> if (EFI_ERROR (Status)) {
>
> DEBUG ((DEBUG_ERROR, "%a, fail to get resource UUID: %r\n", __func__,
> Status));
>
> - return FALSE;
>
> + goto ON_RELEASE;
>
> }
>
>
>
> Status = NetLibGetSystemGuid (&SystemUuid);
>
> if (EFI_ERROR (Status)) {
>
> DEBUG ((DEBUG_ERROR, "%a, fail to get system UUID from SMBIOS: %r\n",
> __func__, Status));
>
> - return FALSE;
>
> + goto ON_RELEASE;
>
> }
>
>
>
> DEBUG ((REDFISH_DEBUG_TRACE, "%a, Identify: System: %g Resource: %g\n",
> __func__, &SystemUuid, &ResourceUuid));
>
> @@ -92,6 +93,8 @@ RedfishIdentifyResource (
> Status = EFI_UNSUPPORTED;
>
> }
>
>
>
> +ON_RELEASE:
>
> +
>
> mJsonStructProtocol->DestoryStructure (
>
> mJsonStructProtocol,
>
> (EFI_REST_JSON_STRUCTURE_HEADER *)ComputerSystem
>
> --
> 2.32.0 (Apple Git-132)
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#116568): https://edk2.groups.io/g/devel/message/116568
> Mute This Topic: https://groups.io/mt/104841896/7129762
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [nick...@nvidia.com] -=-=-
> =-=-=-=
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116627): https://edk2.groups.io/g/devel/message/116627
Mute This Topic: https://groups.io/mt/104841896/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-