From 2ff1029cc38ad1b9955c57c5aa04ce0e2127cb9d Mon Sep 17 00:00:00 2001 From: Qihang Gao Date: Tue, 28 Oct 2025 11:22:12 +0800 Subject: [PATCH] RedfishPkg: Add missing FreePool to fix memory leak issue According to the implementation of `HiiGetSupportedLanguages`, the caller is responsible for freeing the returned string using FreePool(). Signed-off-by: Qihang Gao --- .../RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c index 5aaf4adfd1..0d32f16cd9 100644 --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c @@ -508,12 +508,16 @@ GetSupportedSchema ( } if (Count == 0) { + FreePool (SupportedLanguages); + return EFI_NOT_FOUND; } SupportedSchema->Count = Count; SupportedSchema->SchemaList = AllocatePool (sizeof (CHAR8 *) * Count); if (SupportedSchema->SchemaList == NULL) { + FreePool (SupportedLanguages); + return EFI_OUT_OF_RESOURCES; } @@ -539,6 +543,8 @@ GetSupportedSchema ( ++Index; } + FreePool (SupportedLanguages); + return EFI_SUCCESS; }