ShellPkg/ConsistMapping: Remove unneeded memory reallocation

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>
This commit is contained in:
Ruiyu Ni 2017-04-17 14:20:40 +08:00
parent 51a1db9b24
commit 17c3dc1939
1 changed files with 2 additions and 9 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Main file for support of shell consist mapping. Main file for support of shell consist mapping.
Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -1610,7 +1610,6 @@ ShellCommandConsistMappingGenMappingName (
DEVICE_CONSIST_MAPPING_INFO MappingInfo; DEVICE_CONSIST_MAPPING_INFO MappingInfo;
EFI_DEVICE_PATH_PROTOCOL *HIDevicePath; EFI_DEVICE_PATH_PROTOCOL *HIDevicePath;
UINTN Index; UINTN Index;
CHAR16 *NewStr;
ASSERT(DevicePath != NULL); ASSERT(DevicePath != NULL);
ASSERT(Table != NULL); ASSERT(Table != NULL);
@ -1667,13 +1666,7 @@ ShellCommandConsistMappingGenMappingName (
return NULL; return NULL;
} }
NewStr = ReallocatePool (Str.Len * sizeof (CHAR16), (Str.Len + 1) * sizeof (CHAR16), Str.Str); return Str.Str;
if (NewStr == NULL) {
SHELL_FREE_NON_NULL (Str.Str);
return (NULL);
}
NewStr[Str.Len] = CHAR_NULL;
return NewStr;
} }
/** /**