From 2bfac751a7229c5407b5e4571d95d3a07866ec3d Mon Sep 17 00:00:00 2001
From: Star Zeng <star.zeng@intel.com>
Date: Wed, 20 Apr 2016 16:19:01 +0800
Subject: MdeModulePkg DxeCore: Fix a memory leak in
 InstallMemoryAttributesTable()

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
---
 MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c')

diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
index 416ed3dca8..0362212c8b 100644
--- a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
+++ b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
@@ -174,6 +174,8 @@ InstallMemoryAttributesTable (
     }
     MemoryMap = NEXT_MEMORY_DESCRIPTOR(MemoryMap, DescriptorSize);
   }
+  MemoryMap = MemoryMapStart;
+  FreePool (MemoryMap);
 
   Status = gBS->InstallConfigurationTable (&gEfiMemoryAttributesTableGuid, MemoryAttributesTable);
   ASSERT_EFI_ERROR (Status);
-- 
cgit v1.2.3