ShellPkg/ConsistMapping: Remove unneeded memory reallocation
authorRuiyu Ni <ruiyu.ni@intel.com>
Mon, 17 Apr 2017 06:20:40 +0000 (14:20 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Tue, 18 Apr 2017 02:25:09 +0000 (10:25 +0800)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c

index 09f2c563de782bd22658fd531a40a3614252756d..3b13e62340de7c1355688967cd1899ba1fdb0c6f 100755 (executable)
@@ -1,7 +1,7 @@
 /** @file\r
   Main file for support of shell consist mapping.\r
 \r
-  Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2005 - 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
@@ -1610,7 +1610,6 @@ ShellCommandConsistMappingGenMappingName (
   DEVICE_CONSIST_MAPPING_INFO MappingInfo;\r
   EFI_DEVICE_PATH_PROTOCOL    *HIDevicePath;\r
   UINTN                       Index;\r
-  CHAR16                      *NewStr;\r
 \r
   ASSERT(DevicePath         != NULL);\r
   ASSERT(Table  != NULL);\r
@@ -1667,13 +1666,7 @@ ShellCommandConsistMappingGenMappingName (
     return NULL;\r
   }\r
 \r
-  NewStr = ReallocatePool (Str.Len * sizeof (CHAR16), (Str.Len + 1) * sizeof (CHAR16), Str.Str);\r
-  if (NewStr == NULL) {\r
-    SHELL_FREE_NON_NULL (Str.Str);\r
-    return (NULL);\r
-  }\r
-  NewStr[Str.Len] = CHAR_NULL;\r
-  return NewStr;\r
+  return Str.Str;\r
 }\r
 \r
 /**\r