]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg DxeHstiLib: Fix memory leak issue
authorStar Zeng <star.zeng@intel.com>
Fri, 14 Jul 2017 08:47:59 +0000 (16:47 +0800)
committerStar Zeng <star.zeng@intel.com>
Tue, 18 Jul 2017 02:35:36 +0000 (10:35 +0800)
The Hsti returned from InternalHstiFindAip() and temporally
allocated NewHsti need to be freed after used.

Cc: Jiewen Yao <jiewen.yao@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>
MdePkg/Library/DxeHstiLib/HstiDxe.c

index c032a98647bf2b0cf443d8a5876d947275325030..58510766bb43426af4036456ad4beee00bbbd9ad 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-  Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -206,7 +206,7 @@ InternalHstiIsValidTable (
     }\r
   }\r
   if (Index == sizeof(Hsti->ImplementationID)/sizeof(Hsti->ImplementationID[0])) {\r
-    DEBUG ((EFI_D_ERROR, "ImplementationID is no NUL CHAR\n"));\r
+    DEBUG ((EFI_D_ERROR, "ImplementationID has no NUL CHAR\n"));\r
     return FALSE;\r
   }\r
 \r
@@ -416,6 +416,7 @@ InternalHstiRecordFeaturesVerified (
                   Hsti,\r
                   HstiSize\r
                   );\r
+  FreePool (Hsti);\r
   return Status;\r
 }\r
 \r
@@ -545,6 +546,8 @@ InternalHstiRecordErrorString (
                   NewHsti,\r
                   NewHstiSize\r
                   );\r
+  FreePool (Hsti);\r
+  FreePool (NewHsti);\r
   return Status;\r
 }\r
 \r