Reviewed-by: Nickle Wang <[email protected]>

Regards,
Nickle

> -----Original Message-----
> From: [email protected] <[email protected]> On Behalf Of Mike
> Maslenkin via groups.io
> Sent: Sunday, March 10, 2024 6:42 PM
> To: [email protected]
> Cc: Mike Maslenkin <[email protected]>; Abner Chang
> <[email protected]>; Igor Kulchytskyy <[email protected]>; Nickle Wang
> <[email protected]>
> 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 <[email protected]>
> Cc: Igor Kulchytskyy <[email protected]>
> Cc: Nickle Wang <[email protected]>
> Signed-off-by: Mike Maslenkin <[email protected]>
> ---
>  .../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: [email protected]
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]] -=-=-
> =-=-=-=
> 



-=-=-=-=-=-=-=-=-=-=-=-
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: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to