From 181dfc0b184da45ea479968ffb95b8d16514dc39 Mon Sep 17 00:00:00 2001 From: Mike Maslenkin Date: Mon, 5 Feb 2024 01:58:46 +0300 Subject: [PATCH] RedfishClientPkg/Bios: fix leak of GetPendingSettings URI. Cc: Abner Chang Cc: Nickle Wang Cc: Igor Kulchytskyy Signed-off-by: Mike Maslenkin Reviewed-by: Abner Chang Reviewed-by: Nickle Wang --- .../Features/Bios/v1_0_9/Dxe/BiosDxe.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c index db77ed3df..a442d446b 100644 --- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c @@ -132,12 +132,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)); Private->Uri = PendingSettingUri; @@ -206,6 +207,10 @@ RedfishResourceConsumeResource ( FreePool (Etag); } + if (PendingSettingUri != NULL) { + FreePool (PendingSettingUri); + } + return Status; }