* [edk2-devel] [edk2-redfish-client][PATCH v2 2/2] RedfishClientPkg/Features: release resources
@ 2024-04-01 14:17 Nickle Wang via groups.io
2024-04-10 1:47 ` Chang, Abner via groups.io
0 siblings, 1 reply; 2+ messages in thread
From: Nickle Wang via groups.io @ 2024-04-01 14:17 UTC (permalink / raw)
To: devel; +Cc: Abner Chang, Igor Kulchytskyy, Nick Ramirez
-Release Etag and PendingSettingUri resources.
-Update function header for GetHttpResponseEtag() and
GetHttpResponseLocation(). Caller has to release returned
memory buffer from these two functions.
-Fix typo.
Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
---
.../Features/Bios/v1_0_9/Common/BiosCommon.c | 2 +-
.../Features/Bios/v1_0_9/Dxe/BiosDxe.c | 20 ++++++++--
.../BootOption/v1_0_4/Dxe/BootOptionDxe.c | 33 ++++++++++++-----
.../BootOptionCollectionDxe.c | 2 +-
.../v1_13_0/Dxe/ComputerSystemDxe.c | 33 ++++++++++++-----
.../v1_5_0/Dxe/ComputerSystemDxe.c | 33 ++++++++++++-----
.../ComputerSystemCollectionDxe.c | 2 +-
.../Features/Memory/V1_7_1/Dxe/MemoryDxe.c | 37 ++++++++++++++-----
.../MemoryCollectionDxe/MemoryCollectionDxe.c | 2 +-
.../RedfishFeatureUtilityLib.c | 2 +
10 files changed, 118 insertions(+), 48 deletions(-)
diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
index f40fe215a..5dc97876c 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
@@ -815,7 +815,7 @@ HandleResource (
//
// Check and see if target property exist or not even when collection member exists.
- // If not, we sill do provision.
+ // If not, we still do provision.
//
DEBUG ((REDFISH_DEBUG_TRACE, "%a Check for %s\n", __func__, Uri));
Status = EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri, NULL);
diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
index bb64ef862..5955917f2 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
@@ -158,8 +158,12 @@ RedfishResourceConsumeResource (
//
// Searching for etag in HTTP response header
//
- Etag = NULL;
- GetHttpResponseEtag (ExpectedResponse, &Etag);
+ Etag = NULL;
+ Status = GetHttpResponseEtag (ExpectedResponse, &Etag);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, failed to get ETag from HTTP header\n", __func__));
+ }
+
Status = RedfishConsumeResourceCommon (Private, Private->Json, Etag);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a: failed to consume resource from: %s: %r\n", __func__, Private->Uri, Status));
@@ -338,8 +342,12 @@ RedfishResourceCheck (
//
// Find etag in HTTP response header
//
- Etag = NULL;
- GetHttpResponseEtag (&Response, &Etag);
+ Etag = NULL;
+ Status = GetHttpResponseEtag (&Response, &Etag);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, failed to get ETag from HTTP header\n", __func__));
+ }
+
Status = RedfishCheckResourceCommon (Private, Private->Json, Etag);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a, failed to check resource from: %s: %r\n", __func__, Uri, Status));
@@ -348,6 +356,10 @@ RedfishResourceCheck (
//
// Release resource
//
+ if (Etag != NULL) {
+ FreePool (Etag);
+ }
+
RedfishHttpFreeResponse (&Response);
Private->Payload = NULL;
diff --git a/RedfishClientPkg/Features/BootOption/v1_0_4/Dxe/BootOptionDxe.c b/RedfishClientPkg/Features/BootOption/v1_0_4/Dxe/BootOptionDxe.c
index 5a66fe59e..1a1262403 100644
--- a/RedfishClientPkg/Features/BootOption/v1_0_4/Dxe/BootOptionDxe.c
+++ b/RedfishClientPkg/Features/BootOption/v1_0_4/Dxe/BootOptionDxe.c
@@ -122,12 +122,13 @@ RedfishResourceConsumeResource (
//
// Check and see if "@Redfish.Settings" exist or not.
//
- Status = GetPendingSettings (
- Private->RedfishService,
- Response.Payload,
- &PendingSettingResponse,
- &PendingSettingUri
- );
+ PendingSettingUri = NULL;
+ Status = GetPendingSettings (
+ Private->RedfishService,
+ Response.Payload,
+ &PendingSettingResponse,
+ &PendingSettingUri
+ );
if (!EFI_ERROR (Status)) {
DEBUG ((REDFISH_BOOT_OPTION_DEBUG_TRACE, "%a: @Redfish.Settings found: %s\n", __func__, PendingSettingUri));
SetRedfishSettingsObjectsUri (Private->Uri, PendingSettingUri);
@@ -147,8 +148,12 @@ RedfishResourceConsumeResource (
//
// Find etag in HTTP response header
//
- Etag = NULL;
- GetHttpResponseEtag (ExpectedResponse, &Etag);
+ Etag = NULL;
+ Status = GetHttpResponseEtag (ExpectedResponse, &Etag);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: failed to get ETag from HTTP header\n", __func__));
+ }
+
Status = RedfishConsumeResourceCommon (Private, Private->Json, Etag);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a: failed to consume resource from: %s: %r\n", __func__, Private->Uri, Status));
@@ -170,6 +175,10 @@ RedfishResourceConsumeResource (
Private->Json = NULL;
}
+ if (PendingSettingUri != NULL) {
+ FreePool (PendingSettingUri);
+ }
+
return Status;
}
@@ -323,8 +332,12 @@ RedfishResourceCheck (
//
// Find etag in HTTP response header
//
- Etag = NULL;
- GetHttpResponseEtag (&Response, &Etag);
+ Etag = NULL;
+ Status = GetHttpResponseEtag (&Response, &Etag);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: failed to get ETag from HTTP header\n", __func__));
+ }
+
Status = RedfishCheckResourceCommon (Private, Private->Json, Etag);
if (EFI_ERROR (Status)) {
DEBUG ((REDFISH_BOOT_OPTION_DEBUG_TRACE, "%a: failed to check resource from: %s: %r\n", __func__, Uri, Status));
diff --git a/RedfishClientPkg/Features/BootOptionCollection/BootOptionCollectionDxe.c b/RedfishClientPkg/Features/BootOptionCollection/BootOptionCollectionDxe.c
index cd1437f54..79ec739cb 100644
--- a/RedfishClientPkg/Features/BootOptionCollection/BootOptionCollectionDxe.c
+++ b/RedfishClientPkg/Features/BootOptionCollection/BootOptionCollectionDxe.c
@@ -85,7 +85,7 @@ HandleResource (
//
// Check and see if target property exist or not even when collection member exists.
- // If not, we sill do provision.
+ // If not, we still do provision.
//
DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a Check for %s\n", __func__, Uri));
Status = EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri, NULL);
diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.c b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.c
index a0c71212b..9c405bb2f 100644
--- a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.c
+++ b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.c
@@ -125,12 +125,13 @@ RedfishResourceConsumeResource (
// Check and see if "@Redfish.Settings" exist or not.
//
ZeroMem (&PendingSettingResponse, sizeof (REDFISH_RESPONSE));
- Status = GetPendingSettings (
- Private->RedfishService,
- Response.Payload,
- &PendingSettingResponse,
- &PendingSettingUri
- );
+ PendingSettingUri = NULL;
+ Status = GetPendingSettings (
+ Private->RedfishService,
+ Response.Payload,
+ &PendingSettingResponse,
+ &PendingSettingUri
+ );
if (!EFI_ERROR (Status)) {
DEBUG ((REDFISH_DEBUG_TRACE, "%a: @Redfish.Settings found: %s\n", __func__, PendingSettingUri));
SetRedfishSettingsObjectsUri (Private->Uri, PendingSettingUri);
@@ -151,8 +152,12 @@ RedfishResourceConsumeResource (
//
// Find etag in HTTP response header
//
- Etag = NULL;
- GetHttpResponseEtag (ExpectedResponse, &Etag);
+ Etag = NULL;
+ Status = GetHttpResponseEtag (ExpectedResponse, &Etag);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: failed to get ETag from HTTP header\n", __func__));
+ }
+
Status = RedfishConsumeResourceCommon (Private, Private->Json, Etag);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a: failed to consume resource from: %s: %r\n", __func__, Private->Uri, Status));
@@ -177,6 +182,10 @@ RedfishResourceConsumeResource (
Private->Json = NULL;
}
+ if (PendingSettingUri != NULL) {
+ FreePool (PendingSettingUri);
+ }
+
return Status;
}
@@ -330,8 +339,12 @@ RedfishResourceCheck (
//
// Find etag in HTTP response header
//
- Etag = NULL;
- GetHttpResponseEtag (&Response, &Etag);
+ Etag = NULL;
+ Status = GetHttpResponseEtag (&Response, &Etag);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: failed to get ETag from HTTP header\n", __func__));
+ }
+
Status = RedfishCheckResourceCommon (Private, Private->Json, Etag);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a: failed to check resource from: %s: %r\n", __func__, Uri, Status));
diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.c b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.c
index 494bf59df..a58151f67 100644
--- a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.c
+++ b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.c
@@ -126,12 +126,13 @@ RedfishResourceConsumeResource (
// Check and see if "@Redfish.Settings" exist or not.
//
ZeroMem (&PendingSettingResponse, sizeof (REDFISH_RESPONSE));
- Status = GetPendingSettings (
- Private->RedfishService,
- Response.Payload,
- &PendingSettingResponse,
- &PendingSettingUri
- );
+ PendingSettingUri = NULL;
+ Status = GetPendingSettings (
+ Private->RedfishService,
+ Response.Payload,
+ &PendingSettingResponse,
+ &PendingSettingUri
+ );
if (!EFI_ERROR (Status)) {
DEBUG ((REDFISH_DEBUG_TRACE, "%a: @Redfish.Settings found: %s\n", __func__, PendingSettingUri));
SetRedfishSettingsObjectsUri (Private->Uri, PendingSettingUri);
@@ -152,8 +153,12 @@ RedfishResourceConsumeResource (
//
// Find etag in HTTP response header
//
- Etag = NULL;
- GetHttpResponseEtag (ExpectedResponse, &Etag);
+ Etag = NULL;
+ Status = GetHttpResponseEtag (ExpectedResponse, &Etag);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: failed to get ETag from HTTP header\n", __func__));
+ }
+
Status = RedfishConsumeResourceCommon (Private, Private->Json, Etag);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a: failed to consume resource from: %s: %r\n", __func__, Private->Uri, Status));
@@ -178,6 +183,10 @@ RedfishResourceConsumeResource (
Private->Json = NULL;
}
+ if (PendingSettingUri != NULL) {
+ FreePool (PendingSettingUri);
+ }
+
return Status;
}
@@ -331,8 +340,12 @@ RedfishResourceCheck (
//
// Find etag in HTTP response header
//
- Etag = NULL;
- GetHttpResponseEtag (&Response, &Etag);
+ Etag = NULL;
+ Status = GetHttpResponseEtag (&Response, &Etag);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: failed to get ETag from HTTP header\n", __func__));
+ }
+
Status = RedfishCheckResourceCommon (Private, Private->Json, Etag);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a: failed to check resource from: %s: %r\n", __func__, Uri, Status));
diff --git a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
index 3deefa824..868bacf02 100644
--- a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
+++ b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
@@ -91,7 +91,7 @@ HandleResource (
//
// Check and see if target property exist or not even when collection member exists.
- // If not, we sill do provision.
+ // If not, we still do provision.
//
DEBUG ((REDFISH_DEBUG_TRACE, "%a Check for %s\n", __func__, Uri));
Status = EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri, NULL);
diff --git a/RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.c b/RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.c
index f2c0a7735..87ce62c2d 100644
--- a/RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.c
+++ b/RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.c
@@ -126,12 +126,13 @@ RedfishResourceConsumeResource (
// Check and see if "@Redfish.Settings" exist or not.
//
ZeroMem (&PendingSettingResponse, sizeof (REDFISH_RESPONSE));
- Status = GetPendingSettings (
- Private->RedfishService,
- Response.Payload,
- &PendingSettingResponse,
- &PendingSettingUri
- );
+ PendingSettingUri = NULL;
+ Status = GetPendingSettings (
+ Private->RedfishService,
+ Response.Payload,
+ &PendingSettingResponse,
+ &PendingSettingUri
+ );
if (!EFI_ERROR (Status)) {
DEBUG ((REDFISH_DEBUG_TRACE, "%a: @Redfish.Settings found: %s\n", __func__, PendingSettingUri));
SetRedfishSettingsObjectsUri (Private->Uri, PendingSettingUri);
@@ -151,8 +152,12 @@ RedfishResourceConsumeResource (
//
// Find etag in HTTP response header
//
- Etag = NULL;
- GetHttpResponseEtag (ExpectedResponse, &Etag);
+ Etag = NULL;
+ Status = GetHttpResponseEtag (ExpectedResponse, &Etag);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: failed to get ETag from HTTP header\n", __func__));
+ }
+
Status = RedfishConsumeResourceCommon (Private, Private->Json, Etag);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a: failed to consume resource from: %s: %r\n", __func__, Private->Uri, Status));
@@ -174,6 +179,10 @@ RedfishResourceConsumeResource (
FreePool (Etag);
}
+ if (PendingSettingUri != NULL) {
+ FreePool (PendingSettingUri);
+ }
+
return Status;
}
@@ -327,8 +336,12 @@ RedfishResourceCheck (
//
// Find etag in HTTP response header
//
- Etag = NULL;
- GetHttpResponseEtag (&Response, &Etag);
+ Etag = NULL;
+ Status = GetHttpResponseEtag (&Response, &Etag);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: failed to get ETag from HTTP header\n", __func__));
+ }
+
Status = RedfishCheckResourceCommon (Private, Private->Json, Etag);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a, failed to check resource from: %s: %r\n", __func__, Uri, Status));
@@ -337,6 +350,10 @@ RedfishResourceCheck (
//
// Release resource
//
+ if (Etag != NULL) {
+ FreePool (Etag);
+ }
+
RedfishHttpFreeResponse (&Response);
Private->Payload = NULL;
diff --git a/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c
index 38f28f902..6bf7f6fc5 100644
--- a/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c
+++ b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c
@@ -87,7 +87,7 @@ HandleResource (
//
// Check and see if target property exist or not even when collection member exists.
- // If not, we sill do provision.
+ // If not, we still do provision.
//
DEBUG ((REDFISH_DEBUG_TRACE, "%a Check for %s\n", __func__, Uri));
Status = EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri, NULL);
diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index 2cc079783..2add55921 100644
--- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -1744,6 +1744,7 @@ RedfishFeatureGetUnifiedArrayTypeConfigureLang (
/**
Find "ETag" from either HTTP header or Redfish response.
+ It's caller's responsibility to release Etag by calling FreePool().
@param[in] Response HTTP response
@param[out] Etag String buffer to return ETag
@@ -1814,6 +1815,7 @@ GetHttpResponseEtag (
/**
Find "Location" from either HTTP header or Redfish response.
+ It's caller's responsibility to release Location by calling FreePool().
@param[in] Response HTTP response
@param[out] Location String buffer to return Location
--
2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117293): https://edk2.groups.io/g/devel/message/117293
Mute This Topic: https://groups.io/mt/105265012/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] 2+ messages in thread
* Re: [edk2-devel] [edk2-redfish-client][PATCH v2 2/2] RedfishClientPkg/Features: release resources
2024-04-01 14:17 [edk2-devel] [edk2-redfish-client][PATCH v2 2/2] RedfishClientPkg/Features: release resources Nickle Wang via groups.io
@ 2024-04-10 1:47 ` Chang, Abner via groups.io
0 siblings, 0 replies; 2+ messages in thread
From: Chang, Abner via groups.io @ 2024-04-10 1:47 UTC (permalink / raw)
To: Nickle Wang, devel@edk2.groups.io; +Cc: Igor Kulchytskyy, Nick Ramirez
[AMD Official Use Only - General]
Reviewed-by: Abner Chang <abner.chang@amd.com>
> -----Original Message-----
> From: Nickle Wang <nicklew@nvidia.com>
> Sent: Monday, April 1, 2024 10:18 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; Igor Kulchytskyy
> <igork@ami.com>; Nick Ramirez <nramirez@nvidia.com>
> Subject: [edk2-redfish-client][PATCH v2 2/2] RedfishClientPkg/Features: release
> resources
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> -Release Etag and PendingSettingUri resources.
> -Update function header for GetHttpResponseEtag() and
> GetHttpResponseLocation(). Caller has to release returned
> memory buffer from these two functions.
> -Fix typo.
>
> Signed-off-by: Nickle Wang <nicklew@nvidia.com>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Cc: Nick Ramirez <nramirez@nvidia.com>
> ---
> .../Features/Bios/v1_0_9/Common/BiosCommon.c | 2 +-
> .../Features/Bios/v1_0_9/Dxe/BiosDxe.c | 20 ++++++++--
> .../BootOption/v1_0_4/Dxe/BootOptionDxe.c | 33 ++++++++++++-----
> .../BootOptionCollectionDxe.c | 2 +-
> .../v1_13_0/Dxe/ComputerSystemDxe.c | 33 ++++++++++++-----
> .../v1_5_0/Dxe/ComputerSystemDxe.c | 33 ++++++++++++-----
> .../ComputerSystemCollectionDxe.c | 2 +-
> .../Features/Memory/V1_7_1/Dxe/MemoryDxe.c | 37 ++++++++++++++-----
> .../MemoryCollectionDxe/MemoryCollectionDxe.c | 2 +-
> .../RedfishFeatureUtilityLib.c | 2 +
> 10 files changed, 118 insertions(+), 48 deletions(-)
>
> diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> index f40fe215a..5dc97876c 100644
> --- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> @@ -815,7 +815,7 @@ HandleResource (
>
> //
> // Check and see if target property exist or not even when collection member
> exists.
> - // If not, we sill do provision.
> + // If not, we still do provision.
> //
> DEBUG ((REDFISH_DEBUG_TRACE, "%a Check for %s\n", __func__, Uri));
> Status = EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri, NULL);
> diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> index bb64ef862..5955917f2 100644
> --- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> @@ -158,8 +158,12 @@ RedfishResourceConsumeResource (
> //
> // Searching for etag in HTTP response header
> //
> - Etag = NULL;
> - GetHttpResponseEtag (ExpectedResponse, &Etag);
> + Etag = NULL;
> + Status = GetHttpResponseEtag (ExpectedResponse, &Etag);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a, failed to get ETag from HTTP header\n",
> __func__));
> + }
> +
> Status = RedfishConsumeResourceCommon (Private, Private->Json, Etag);
> if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "%a: failed to consume resource from: %s: %r\n",
> __func__, Private->Uri, Status));
> @@ -338,8 +342,12 @@ RedfishResourceCheck (
> //
> // Find etag in HTTP response header
> //
> - Etag = NULL;
> - GetHttpResponseEtag (&Response, &Etag);
> + Etag = NULL;
> + Status = GetHttpResponseEtag (&Response, &Etag);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a, failed to get ETag from HTTP header\n",
> __func__));
> + }
> +
> Status = RedfishCheckResourceCommon (Private, Private->Json, Etag);
> if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "%a, failed to check resource from: %s: %r\n",
> __func__, Uri, Status));
> @@ -348,6 +356,10 @@ RedfishResourceCheck (
> //
> // Release resource
> //
> + if (Etag != NULL) {
> + FreePool (Etag);
> + }
> +
> RedfishHttpFreeResponse (&Response);
> Private->Payload = NULL;
>
> diff --git a/RedfishClientPkg/Features/BootOption/v1_0_4/Dxe/BootOptionDxe.c
> b/RedfishClientPkg/Features/BootOption/v1_0_4/Dxe/BootOptionDxe.c
> index 5a66fe59e..1a1262403 100644
> --- a/RedfishClientPkg/Features/BootOption/v1_0_4/Dxe/BootOptionDxe.c
> +++ b/RedfishClientPkg/Features/BootOption/v1_0_4/Dxe/BootOptionDxe.c
> @@ -122,12 +122,13 @@ RedfishResourceConsumeResource (
> //
> // Check and see if "@Redfish.Settings" exist or not.
> //
> - Status = GetPendingSettings (
> - Private->RedfishService,
> - Response.Payload,
> - &PendingSettingResponse,
> - &PendingSettingUri
> - );
> + PendingSettingUri = NULL;
> + Status = GetPendingSettings (
> + Private->RedfishService,
> + Response.Payload,
> + &PendingSettingResponse,
> + &PendingSettingUri
> + );
> if (!EFI_ERROR (Status)) {
> DEBUG ((REDFISH_BOOT_OPTION_DEBUG_TRACE, "%a: @Redfish.Settings
> found: %s\n", __func__, PendingSettingUri));
> SetRedfishSettingsObjectsUri (Private->Uri, PendingSettingUri);
> @@ -147,8 +148,12 @@ RedfishResourceConsumeResource (
> //
> // Find etag in HTTP response header
> //
> - Etag = NULL;
> - GetHttpResponseEtag (ExpectedResponse, &Etag);
> + Etag = NULL;
> + Status = GetHttpResponseEtag (ExpectedResponse, &Etag);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: failed to get ETag from HTTP header\n",
> __func__));
> + }
> +
> Status = RedfishConsumeResourceCommon (Private, Private->Json, Etag);
> if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "%a: failed to consume resource from: %s: %r\n",
> __func__, Private->Uri, Status));
> @@ -170,6 +175,10 @@ RedfishResourceConsumeResource (
> Private->Json = NULL;
> }
>
> + if (PendingSettingUri != NULL) {
> + FreePool (PendingSettingUri);
> + }
> +
> return Status;
> }
>
> @@ -323,8 +332,12 @@ RedfishResourceCheck (
> //
> // Find etag in HTTP response header
> //
> - Etag = NULL;
> - GetHttpResponseEtag (&Response, &Etag);
> + Etag = NULL;
> + Status = GetHttpResponseEtag (&Response, &Etag);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: failed to get ETag from HTTP header\n",
> __func__));
> + }
> +
> Status = RedfishCheckResourceCommon (Private, Private->Json, Etag);
> if (EFI_ERROR (Status)) {
> DEBUG ((REDFISH_BOOT_OPTION_DEBUG_TRACE, "%a: failed to check
> resource from: %s: %r\n", __func__, Uri, Status));
> diff --git
> a/RedfishClientPkg/Features/BootOptionCollection/BootOptionCollectionDxe.c
> b/RedfishClientPkg/Features/BootOptionCollection/BootOptionCollectionDxe.c
> index cd1437f54..79ec739cb 100644
> ---
> a/RedfishClientPkg/Features/BootOptionCollection/BootOptionCollectionDxe.c
> +++
> b/RedfishClientPkg/Features/BootOptionCollection/BootOptionCollectionDxe.c
> @@ -85,7 +85,7 @@ HandleResource (
>
> //
> // Check and see if target property exist or not even when collection member
> exists.
> - // If not, we sill do provision.
> + // If not, we still do provision.
> //
> DEBUG ((REDFISH_BOOT_OPTION_COLLECTION_DEBUG_TRACE, "%a Check
> for %s\n", __func__, Uri));
> Status = EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri, NULL);
> diff --git
> a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemD
> xe.c
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemD
> xe.c
> index a0c71212b..9c405bb2f 100644
> ---
> a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemD
> xe.c
> +++
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemD
> xe.c
> @@ -125,12 +125,13 @@ RedfishResourceConsumeResource (
> // Check and see if "@Redfish.Settings" exist or not.
> //
> ZeroMem (&PendingSettingResponse, sizeof (REDFISH_RESPONSE));
> - Status = GetPendingSettings (
> - Private->RedfishService,
> - Response.Payload,
> - &PendingSettingResponse,
> - &PendingSettingUri
> - );
> + PendingSettingUri = NULL;
> + Status = GetPendingSettings (
> + Private->RedfishService,
> + Response.Payload,
> + &PendingSettingResponse,
> + &PendingSettingUri
> + );
> if (!EFI_ERROR (Status)) {
> DEBUG ((REDFISH_DEBUG_TRACE, "%a: @Redfish.Settings found: %s\n",
> __func__, PendingSettingUri));
> SetRedfishSettingsObjectsUri (Private->Uri, PendingSettingUri);
> @@ -151,8 +152,12 @@ RedfishResourceConsumeResource (
> //
> // Find etag in HTTP response header
> //
> - Etag = NULL;
> - GetHttpResponseEtag (ExpectedResponse, &Etag);
> + Etag = NULL;
> + Status = GetHttpResponseEtag (ExpectedResponse, &Etag);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: failed to get ETag from HTTP header\n",
> __func__));
> + }
> +
> Status = RedfishConsumeResourceCommon (Private, Private->Json, Etag);
> if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "%a: failed to consume resource from: %s: %r\n",
> __func__, Private->Uri, Status));
> @@ -177,6 +182,10 @@ RedfishResourceConsumeResource (
> Private->Json = NULL;
> }
>
> + if (PendingSettingUri != NULL) {
> + FreePool (PendingSettingUri);
> + }
> +
> return Status;
> }
>
> @@ -330,8 +339,12 @@ RedfishResourceCheck (
> //
> // Find etag in HTTP response header
> //
> - Etag = NULL;
> - GetHttpResponseEtag (&Response, &Etag);
> + Etag = NULL;
> + Status = GetHttpResponseEtag (&Response, &Etag);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: failed to get ETag from HTTP header\n",
> __func__));
> + }
> +
> Status = RedfishCheckResourceCommon (Private, Private->Json, Etag);
> if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "%a: failed to check resource from: %s: %r\n",
> __func__, Uri, Status));
> diff --git
> a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDx
> e.c
> b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDx
> e.c
> index 494bf59df..a58151f67 100644
> ---
> a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDx
> e.c
> +++
> b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDx
> e.c
> @@ -126,12 +126,13 @@ RedfishResourceConsumeResource (
> // Check and see if "@Redfish.Settings" exist or not.
> //
> ZeroMem (&PendingSettingResponse, sizeof (REDFISH_RESPONSE));
> - Status = GetPendingSettings (
> - Private->RedfishService,
> - Response.Payload,
> - &PendingSettingResponse,
> - &PendingSettingUri
> - );
> + PendingSettingUri = NULL;
> + Status = GetPendingSettings (
> + Private->RedfishService,
> + Response.Payload,
> + &PendingSettingResponse,
> + &PendingSettingUri
> + );
> if (!EFI_ERROR (Status)) {
> DEBUG ((REDFISH_DEBUG_TRACE, "%a: @Redfish.Settings found: %s\n",
> __func__, PendingSettingUri));
> SetRedfishSettingsObjectsUri (Private->Uri, PendingSettingUri);
> @@ -152,8 +153,12 @@ RedfishResourceConsumeResource (
> //
> // Find etag in HTTP response header
> //
> - Etag = NULL;
> - GetHttpResponseEtag (ExpectedResponse, &Etag);
> + Etag = NULL;
> + Status = GetHttpResponseEtag (ExpectedResponse, &Etag);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: failed to get ETag from HTTP header\n",
> __func__));
> + }
> +
> Status = RedfishConsumeResourceCommon (Private, Private->Json, Etag);
> if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "%a: failed to consume resource from: %s: %r\n",
> __func__, Private->Uri, Status));
> @@ -178,6 +183,10 @@ RedfishResourceConsumeResource (
> Private->Json = NULL;
> }
>
> + if (PendingSettingUri != NULL) {
> + FreePool (PendingSettingUri);
> + }
> +
> return Status;
> }
>
> @@ -331,8 +340,12 @@ RedfishResourceCheck (
> //
> // Find etag in HTTP response header
> //
> - Etag = NULL;
> - GetHttpResponseEtag (&Response, &Etag);
> + Etag = NULL;
> + Status = GetHttpResponseEtag (&Response, &Etag);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: failed to get ETag from HTTP header\n",
> __func__));
> + }
> +
> Status = RedfishCheckResourceCommon (Private, Private->Json, Etag);
> if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "%a: failed to check resource from: %s: %r\n",
> __func__, Uri, Status));
> diff --git
> a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemC
> ollectionDxe.c
> b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemC
> ollectionDxe.c
> index 3deefa824..868bacf02 100644
> ---
> a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemC
> ollectionDxe.c
> +++
> b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemC
> ollectionDxe.c
> @@ -91,7 +91,7 @@ HandleResource (
>
> //
> // Check and see if target property exist or not even when collection member
> exists.
> - // If not, we sill do provision.
> + // If not, we still do provision.
> //
> DEBUG ((REDFISH_DEBUG_TRACE, "%a Check for %s\n", __func__, Uri));
> Status = EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri, NULL);
> diff --git a/RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.c
> b/RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.c
> index f2c0a7735..87ce62c2d 100644
> --- a/RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.c
> +++ b/RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.c
> @@ -126,12 +126,13 @@ RedfishResourceConsumeResource (
> // Check and see if "@Redfish.Settings" exist or not.
> //
> ZeroMem (&PendingSettingResponse, sizeof (REDFISH_RESPONSE));
> - Status = GetPendingSettings (
> - Private->RedfishService,
> - Response.Payload,
> - &PendingSettingResponse,
> - &PendingSettingUri
> - );
> + PendingSettingUri = NULL;
> + Status = GetPendingSettings (
> + Private->RedfishService,
> + Response.Payload,
> + &PendingSettingResponse,
> + &PendingSettingUri
> + );
> if (!EFI_ERROR (Status)) {
> DEBUG ((REDFISH_DEBUG_TRACE, "%a: @Redfish.Settings found: %s\n",
> __func__, PendingSettingUri));
> SetRedfishSettingsObjectsUri (Private->Uri, PendingSettingUri);
> @@ -151,8 +152,12 @@ RedfishResourceConsumeResource (
> //
> // Find etag in HTTP response header
> //
> - Etag = NULL;
> - GetHttpResponseEtag (ExpectedResponse, &Etag);
> + Etag = NULL;
> + Status = GetHttpResponseEtag (ExpectedResponse, &Etag);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: failed to get ETag from HTTP header\n",
> __func__));
> + }
> +
> Status = RedfishConsumeResourceCommon (Private, Private->Json, Etag);
> if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "%a: failed to consume resource from: %s: %r\n",
> __func__, Private->Uri, Status));
> @@ -174,6 +179,10 @@ RedfishResourceConsumeResource (
> FreePool (Etag);
> }
>
> + if (PendingSettingUri != NULL) {
> + FreePool (PendingSettingUri);
> + }
> +
> return Status;
> }
>
> @@ -327,8 +336,12 @@ RedfishResourceCheck (
> //
> // Find etag in HTTP response header
> //
> - Etag = NULL;
> - GetHttpResponseEtag (&Response, &Etag);
> + Etag = NULL;
> + Status = GetHttpResponseEtag (&Response, &Etag);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: failed to get ETag from HTTP header\n",
> __func__));
> + }
> +
> Status = RedfishCheckResourceCommon (Private, Private->Json, Etag);
> if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "%a, failed to check resource from: %s: %r\n",
> __func__, Uri, Status));
> @@ -337,6 +350,10 @@ RedfishResourceCheck (
> //
> // Release resource
> //
> + if (Etag != NULL) {
> + FreePool (Etag);
> + }
> +
> RedfishHttpFreeResponse (&Response);
> Private->Payload = NULL;
>
> diff --git
> a/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c
> b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c
> index 38f28f902..6bf7f6fc5 100644
> --- a/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c
> +++
> b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c
> @@ -87,7 +87,7 @@ HandleResource (
>
> //
> // Check and see if target property exist or not even when collection member
> exists.
> - // If not, we sill do provision.
> + // If not, we still do provision.
> //
> DEBUG ((REDFISH_DEBUG_TRACE, "%a Check for %s\n", __func__, Uri));
> Status = EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri, NULL);
> diff --git
> a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
> b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
> index 2cc079783..2add55921 100644
> ---
> a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
> +++
> b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
> @@ -1744,6 +1744,7 @@ RedfishFeatureGetUnifiedArrayTypeConfigureLang (
>
> /**
> Find "ETag" from either HTTP header or Redfish response.
> + It's caller's responsibility to release Etag by calling FreePool().
>
> @param[in] Response HTTP response
> @param[out] Etag String buffer to return ETag
> @@ -1814,6 +1815,7 @@ GetHttpResponseEtag (
>
> /**
> Find "Location" from either HTTP header or Redfish response.
> + It's caller's responsibility to release Location by calling FreePool().
>
> @param[in] Response HTTP response
> @param[out] Location String buffer to return Location
> --
> 2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117561): https://edk2.groups.io/g/devel/message/117561
Mute This Topic: https://groups.io/mt/105265012/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-10 1:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-01 14:17 [edk2-devel] [edk2-redfish-client][PATCH v2 2/2] RedfishClientPkg/Features: release resources Nickle Wang via groups.io
2024-04-10 1:47 ` 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