From 5808a099ab9f1e6b8b99368829388c5fd563cb65 Mon Sep 17 00:00:00 2001 From: Vincent Zimmer Date: Fri, 13 Dec 2024 09:15:07 -0800 Subject: [PATCH] Fix memory leak per https://github.com/microsoft/mu_tiano_platforms/issues/632, remove Mu comment --- .../ConfigKnobs/ConfigDataGfx/ConfigDataGfx.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Platforms/QemuQ35Pkg/ConfigKnobs/ConfigDataGfx/ConfigDataGfx.c b/Platforms/QemuQ35Pkg/ConfigKnobs/ConfigDataGfx/ConfigDataGfx.c index 855b7e48f2..22453429fc 100644 --- a/Platforms/QemuQ35Pkg/ConfigKnobs/ConfigDataGfx/ConfigDataGfx.c +++ b/Platforms/QemuQ35Pkg/ConfigKnobs/ConfigDataGfx/ConfigDataGfx.c @@ -66,8 +66,9 @@ ApplyGfxConfigToPolicy ( if (GfxSiliconPolicy == NULL) { DEBUG ((DEBUG_ERROR, "Failed to allocate Policy structure\n")); + Status = EFI_OUT_OF_RESOURCES; goto Exit; - } // Mu + } // We only translate the GFX ports #0 exposed to platform from conf data GfxSiliconPolicy[0].Power_State_Port = GfxEnablePort0; @@ -76,11 +77,13 @@ ApplyGfxConfigToPolicy ( if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a Failed to update GFX policy per configuration data - %r!!!\n", __func__, Status)); - ASSERT (FALSE); - FreePool (GfxSiliconPolicy); //Mu - goto Exit; + ASSERT_EFI_ERROR (Status); } - FreePool (GfxSiliconPolicy); //Mu + Exit: + if (GfxSiliconPolicy != NULL) { + FreePool (GfxSiliconPolicy); + } + return Status; }