MdePkg UefiLib: Fix in EfiLocateProtocolBuffer()
authorStar Zeng <star.zeng@intel.com>
Fri, 13 Apr 2018 06:29:49 +0000 (14:29 +0800)
committerStar Zeng <star.zeng@intel.com>
Tue, 5 Jun 2018 09:43:15 +0000 (17:43 +0800)
Free HandleBuffer for error path in EfiLocateProtocolBuffer().

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
MdePkg/Library/UefiLib/UefiLib.c

index 23faa63..9ade1b0 100644 (file)
@@ -1678,6 +1678,10 @@ EfiLocateProtocolBuffer (
                   (VOID **)Buffer\r
                   );\r
   if (EFI_ERROR (Status)) {\r
+    //\r
+    // Free the handle buffer\r
+    //\r
+    gBS->FreePool (HandleBuffer);\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
   ZeroMem (*Buffer, NoHandles * sizeof (VOID *));\r