]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
MdeModulePkg/NvmExpressDxe: Memory leak fix in async code flow
[mirror_edk2.git] / MdeModulePkg / Application / CapsuleApp / CapsuleApp.c
index 51372593de4ed125ddf674bb8ea7ae4d846559d4..84ed4d738bc4ba777124643168d93b2d2744ad67 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   A shell application that triggers capsule update process.\r
 \r
-  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2016 - 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
@@ -142,24 +142,6 @@ WriteFileFromBuffer (
   IN  VOID                                 *Buffer\r
   );\r
 \r
-/**\r
-  Converts a string to GUID value.\r
-  Guid Format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\r
-\r
-  @param[in]  Str              The registry format GUID string that contains the GUID value.\r
-  @param[out] Guid             A pointer to the converted GUID value.\r
-\r
-  @retval EFI_SUCCESS     The GUID string was successfully converted to the GUID value.\r
-  @retval EFI_UNSUPPORTED The input string is not in registry format.\r
-  @return others          Some error occurred when converting part of GUID value.\r
-\r
-**/\r
-EFI_STATUS\r
-StrToGuid (\r
-  IN  CHAR16   *Str,\r
-  OUT EFI_GUID *Guid\r
-  );\r
-\r
 /**\r
 \r
   This function parse application ARG.\r
@@ -731,6 +713,7 @@ UefiMain (
   )\r
 {\r
   EFI_STATUS                    Status;\r
+  RETURN_STATUS                 RStatus;\r
   UINTN                         FileSize[MAX_CAPSULE_NUM];\r
   VOID                          *CapsuleBuffer[MAX_CAPSULE_NUM];\r
   EFI_CAPSULE_BLOCK_DESCRIPTOR  *BlockDescriptors;\r
@@ -782,10 +765,10 @@ UefiMain (
         //\r
         // FMP->GetImage()\r
         //\r
-        Status = StrToGuid(Argv[3], &ImageTypeId);\r
-        if (EFI_ERROR(Status)) {\r
+        RStatus = StrToGuid (Argv[3], &ImageTypeId);\r
+        if (RETURN_ERROR (RStatus) || (Argv[3][GUID_STRING_LENGTH] != L'\0')) {\r
           Print (L"Invalid ImageTypeId - %s\n", Argv[3]);\r
-          return Status;\r
+          return EFI_INVALID_PARAMETER;\r
         }\r
         ImageIndex = StrDecimalToUintn(Argv[4]);\r
         if (StrCmp(Argv[5], L"-O") == 0) {\r