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