From d81813368a66c1b27f58ecc68e75d1bc850a3e96 Mon Sep 17 00:00:00 2001 From: Mike Maslenkin Date: Wed, 30 Aug 2023 00:33:07 +0300 Subject: RedfishPkg: RedfishPlatformConfigDxe: reduce memory allocations It's unclear why the new string is allocated as copy of the original string if its pointer is stored in an array and the original string is released immediately after the copy is created. All data allocated in the same pool. Cc: Nickle Wang Cc: Igor Kulchytskyy Signed-off-by: Mike Maslenkin Reviewed-by: Abner Chang --- RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'RedfishPkg') diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c index cbc65ba594..f970e317b3 100644 --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c @@ -2057,9 +2057,7 @@ RedfishPlatformConfigProtocolGetConfigureLang ( TmpString = HiiGetRedfishString (StatementRef->Statement->ParentForm->ParentFormset->HiiHandle, FullSchema, StatementRef->Statement->Description); ASSERT (TmpString != NULL); if (TmpString != NULL) { - TmpConfigureLangList[Index] = AllocateCopyPool (StrSize (TmpString), TmpString); - ASSERT (TmpConfigureLangList[Index] != NULL); - FreePool (TmpString); + TmpConfigureLangList[Index] = TmpString; ++Index; } } -- cgit v1.2.3