]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c
ShellPkg: Refactor string manipulation
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel2CommandsLib / Cd.c
index c0d3c920f492fb70f332c59a26a14b2022c6b37f..aa5a20857fc41b334131b0521ade1d9065d5e42d 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Main file for attrib shell level 2 function.\r
 \r
-  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2014, 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
@@ -194,12 +194,11 @@ ShellCommandRunCd (
           //\r
           // change directory with a drive letter\r
           //\r
-          Drive = AllocateZeroPool(StrSize(Param1Copy));\r
+          Drive = AllocateCopyPool(StrSize(Param1Copy), Param1Copy);\r
           if (Drive == NULL) {\r
             ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellLevel2HiiHandle);\r
             ShellStatus = SHELL_OUT_OF_RESOURCES;\r
           } else {\r
-            Drive = StrCpy(Drive, Param1Copy);\r
             Path = StrStr(Drive, L":");\r
             ASSERT(Path != NULL);\r
             if (EFI_ERROR(ShellIsDirectory(Param1Copy))) {\r