From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DD77E20D7A3AE for ; Sun, 16 Apr 2017 23:28:52 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 16 Apr 2017 23:28:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,213,1488873600"; d="scan'208";a="249980241" Received: from ray-dev.ccr.corp.intel.com ([10.239.9.25]) by fmsmga004.fm.intel.com with ESMTP; 16 Apr 2017 23:28:51 -0700 From: Ruiyu Ni To: edk2-devel@lists.01.org Cc: Michael Turner , Jaben Carsey Date: Mon, 17 Apr 2017 14:28:49 +0800 Message-Id: <20170417062849.90528-1-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.9.0.windows.1 Subject: [PATCH] ShellPkg/ConsistMapping: Remove unneeded memory reallocation X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Apr 2017 06:28:53 -0000 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Cc: Michael Turner Cc: Jaben Carsey --- ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c index 09f2c56..3b13e62 100755 --- a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c +++ b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c @@ -1,7 +1,7 @@ /** @file Main file for support of shell consist mapping. - Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials 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 @@ -1610,7 +1610,6 @@ ShellCommandConsistMappingGenMappingName ( DEVICE_CONSIST_MAPPING_INFO MappingInfo; EFI_DEVICE_PATH_PROTOCOL *HIDevicePath; UINTN Index; - CHAR16 *NewStr; ASSERT(DevicePath != NULL); ASSERT(Table != NULL); @@ -1667,13 +1666,7 @@ ShellCommandConsistMappingGenMappingName ( return NULL; } - NewStr = ReallocatePool (Str.Len * sizeof (CHAR16), (Str.Len + 1) * sizeof (CHAR16), Str.Str); - if (NewStr == NULL) { - SHELL_FREE_NON_NULL (Str.Str); - return (NULL); - } - NewStr[Str.Len] = CHAR_NULL; - return NewStr; + return Str.Str; } /** -- 2.9.0.windows.1