[AMD Official Use Only - General]

Reviewed-by: Abner Chang <abner.ch...@amd.com>

> -----Original Message-----
> From: Mike Maslenkin <mike.maslen...@gmail.com>
> Sent: Monday, December 25, 2023 6:59 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <abner.ch...@amd.com>; nick...@nvidia.com;
> ig...@ami.com; Mike Maslenkin <mike.maslen...@gmail.com>
> Subject: [PATCH v3 13/16] RedfishDiscoverDxe: add a helper function
> deallocating string resources.
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> This patch adds a handy helper function deallocating resources from the
> EFI_REDFISH_DISCOVERED_INFORMATION structure instance.
>
> Cc: Abner Chang <abner.ch...@amd.com>
> Cc: Nickle Wang <nick...@nvidia.com>
> Cc: Igor Kulchytskyy <ig...@ami.com>
> Signed-off-by: Mike Maslenkin <mike.maslen...@gmail.com>
> ---
>  .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 68 ++++++++++++-------
>  1 file changed, 44 insertions(+), 24 deletions(-)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 76f87e4fe5e7..ff0c3ff1d1f5 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -712,6 +712,49 @@ DiscoverRedfishHostInterface (
>    return Status;
>
>  }
>
>
>
> +/**
>
> +  The function releases particular strings into the structure instance.
>
> +
>
> +  @param[in]  Information           EFI_REDFISH_DISCOVERED_INFORMATION
>
> +
>
> +**/
>
> +STATIC
>
> +VOID
>
> +FreeInformationData (
>
> +  IN EFI_REDFISH_DISCOVERED_INFORMATION  *Information
>
> +  )
>
> +{
>
> +  if (Information->Location != NULL) {
>
> +    FreePool (Information->Location);
>
> +    Information->Location = NULL;
>
> +  }
>
> +
>
> +  if (Information->Uuid != NULL) {
>
> +    FreePool (Information->Uuid);
>
> +    Information->Uuid = NULL;
>
> +  }
>
> +
>
> +  if (Information->Os != NULL) {
>
> +    FreePool (Information->Os);
>
> +    Information->Os = NULL;
>
> +  }
>
> +
>
> +  if (Information->OsVersion != NULL) {
>
> +    FreePool (Information->OsVersion);
>
> +    Information->OsVersion = NULL;
>
> +  }
>
> +
>
> +  if (Information->Product != NULL) {
>
> +    FreePool (Information->Product);
>
> +    Information->Product = NULL;
>
> +  }
>
> +
>
> +  if (Information->ProductVer != NULL) {
>
> +    FreePool (Information->ProductVer);
>
> +    Information->ProductVer = NULL;
>
> +  }
>
> +}
>
> +
>
>  /**
>
>    The function initializes particular strings into the structure instance.
>
>
>
> @@ -1514,30 +1557,7 @@ RedfishServiceReleaseService (
>      do {
>
>        if (DiscoveredRedfishInstance->Instance == ThisRedfishInstance) {
>
>          RemoveEntryList (&DiscoveredRedfishInstance->NextInstance);
>
> -        if (ThisRedfishInstance->Information.Location != NULL) {
>
> -          FreePool (ThisRedfishInstance->Information.Location);
>
> -        }
>
> -
>
> -        if (ThisRedfishInstance->Information.Uuid != NULL) {
>
> -          FreePool (ThisRedfishInstance->Information.Uuid);
>
> -        }
>
> -
>
> -        if (ThisRedfishInstance->Information.Os != NULL) {
>
> -          FreePool (ThisRedfishInstance->Information.Os);
>
> -        }
>
> -
>
> -        if (ThisRedfishInstance->Information.OsVersion != NULL) {
>
> -          FreePool (ThisRedfishInstance->Information.OsVersion);
>
> -        }
>
> -
>
> -        if (ThisRedfishInstance->Information.Product != NULL) {
>
> -          FreePool (ThisRedfishInstance->Information.Product);
>
> -        }
>
> -
>
> -        if (ThisRedfishInstance->Information.ProductVer != NULL) {
>
> -          FreePool (ThisRedfishInstance->Information.ProductVer);
>
> -        }
>
> -
>
> +        FreeInformationData (&ThisRedfishInstance->Information);
>
>          FreePool ((VOID *)ThisRedfishInstance);
>
>          goto ReleaseNext;
>
>        }
>
> --
> 2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112894): https://edk2.groups.io/g/devel/message/112894
Mute This Topic: https://groups.io/mt/103354132/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to