]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.c
ShellPkg/Hexedit: Fix FreePool() ASSERT() when writing disk
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / HexEdit / DiskImage.c
index a50b52f5f207b68d51dc7cbf2a0aeb0683ee0ded..1c93cd8958412fddd6db76dae63cb3c84f3592bb 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Functions to deal with Disk buffer.\r
 \r
-  Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>\r
+  Copyright (c) 2005 - 2016, 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
@@ -343,6 +343,7 @@ HDiskImageSave (
 \r
   CONST EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
   EFI_DEVICE_PATH_PROTOCOL        *DupDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL        *DupDevicePathForFree;\r
   EFI_BLOCK_IO_PROTOCOL           *BlkIo;\r
   EFI_STATUS                      Status;\r
   EFI_HANDLE                      Handle;\r
@@ -364,12 +365,13 @@ HDiskImageSave (
     return EFI_INVALID_PARAMETER;\r
   }\r
   DupDevicePath = DuplicateDevicePath(DevicePath);\r
+  DupDevicePathForFree = DupDevicePath;\r
 \r
   //\r
   // get blkio interface\r
   //\r
   Status = gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid,&DupDevicePath,&Handle);\r
-  FreePool(DupDevicePath);\r
+  FreePool(DupDevicePathForFree);\r
   if (EFI_ERROR (Status)) {\r
 //    StatusBarSetStatusString (L"Read Disk Failed");\r
     return Status;\r