]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
ShellPkg: Update sources to include MdePkg protocol definitions
[mirror_edk2.git] / ShellPkg / Library / UefiHandleParsingLib / UefiHandleParsingLib.c
index e11a3ccceab369bdc59a994f133b6d8316000bb0..28a582f8d33ca21175721c9fc588ac349b695e27 100644 (file)
@@ -29,7 +29,6 @@ UINTN             GuidListCount;
   @retval               A string representation of the type allocated from BS Pool.\r
 **/\r
 CHAR16*\r
-EFIAPI\r
 ConvertMemoryType (\r
   IN CONST EFI_MEMORY_TYPE Memory\r
   )\r
@@ -66,7 +65,6 @@ ConvertMemoryType (
   @retval               A string representation of the type allocated from BS Pool.\r
 **/\r
 CHAR16*\r
-EFIAPI\r
 ConvertPixelFormat (\r
   IN CONST EFI_GRAPHICS_PIXEL_FORMAT Fmt\r
   )\r
@@ -1831,7 +1829,6 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = {
   @return                       The node.\r
 **/\r
 CONST GUID_INFO_BLOCK *\r
-EFIAPI\r
 InternalShellGetNodeFromGuid(\r
   IN CONST EFI_GUID* Guid\r
   )\r
@@ -1875,7 +1872,6 @@ Function to add a new GUID/Name mapping.
 @retval EFI_INVALID_PARAMETER Guid NameId was invalid\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 InsertNewGuidNameMapping(\r
   IN CONST EFI_GUID           *Guid,\r
   IN CONST EFI_STRING_ID      NameID,\r
@@ -2190,7 +2186,6 @@ GetStringNameFromHandle(
   @retval EFI_SUCCESS     The operation was successful.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 InternalShellInitHandleList(\r
   VOID\r
   )\r
@@ -2802,11 +2797,18 @@ ParseHandleDatabaseForChildControllers(
 \r
   FreePool (DriverBindingHandleBuffer);\r
 \r
+  if (MatchingHandleBuffer == NULL || *MatchingHandleCount == 0) {\r
+    //\r
+    // The caller is not interested in the actual handles, or we've found none.\r
+    //\r
+    FreePool (HandleBufferForReturn);\r
+    HandleBufferForReturn = NULL;\r
+  }\r
+\r
   if (MatchingHandleBuffer != NULL) {\r
     *MatchingHandleBuffer = HandleBufferForReturn;\r
-  } else {\r
-    FreePool(HandleBufferForReturn);\r
   }\r
+\r
   ASSERT ((MatchingHandleBuffer == NULL) ||\r
           (*MatchingHandleCount == 0 && *MatchingHandleBuffer == NULL) ||\r
           (*MatchingHandleCount != 0 && *MatchingHandleBuffer != NULL));\r
@@ -2830,7 +2832,6 @@ ParseHandleDatabaseForChildControllers(
   @return                           A pointer to (*DestinationBuffer).\r
 **/\r
 VOID*\r
-EFIAPI\r
 BuffernCatGrow (\r
   IN OUT VOID   **DestinationBuffer,\r
   IN OUT UINTN  *DestinationSize,\r