]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Ebl/EfiDevice.c
Fix bug in LoadFv command. Don't free the buffer the file was loaded into as the...
[mirror_edk2.git] / EmbeddedPkg / Ebl / EfiDevice.c
index 9b08fda12a3cd6f531ee315f45f461aa64d8a461..dafe0c9a05935b1a4eedfd0039e00e2bd0645e36 100644 (file)
@@ -212,10 +212,11 @@ EblDeviceCmd (
   UINTN         Max;\r
 \r
   CurrentRow = 0;\r
-  \r
+\r
   // Need to call here to make sure Device Counts are valid\r
   EblUpdateDeviceLists ();\r
 \r
+  // Now we can print out the info...\r
   Max = EfiGetDeviceCounts (EfiOpenFirmwareVolume);\r
   if (Max != 0) {\r
     AsciiPrint ("Firmware Volume Devices:\n");\r
@@ -402,7 +403,9 @@ EblLoadFvCmd (
     }\r
       \r
     Status = gDS->ProcessFirmwareVolume (FvStart, FvSize, &FvHandle);\r
-    FreePool (FvStart);\r
+    if (EFI_ERROR (Status)) {\r
+      FreePool (FvStart);\r
+    } \r
   }\r
   return Status;\r
 }\r
@@ -730,7 +733,7 @@ EblFileCopyCmd (
   UINTN         Size;\r
   UINTN         Offset;\r
   UINTN         Chunk = FILE_COPY_CHUNK;\r
-  \r
+\r
   if (Argc < 3) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
@@ -759,13 +762,13 @@ EblFileCopyCmd (
     \r
     Status = EfiRead(Source, Buffer, &Chunk);\r
     if (EFI_ERROR(Status)) {\r
-      AsciiPrint("Read file error\n");\r
+      AsciiPrint("Read file error %r\n", Status);\r
       goto Exit;\r
     }\r
 \r
     Status = EfiWrite(Destination, Buffer, &Chunk);\r
     if (EFI_ERROR(Status)) {\r
-      AsciiPrint("Write file error\n");\r
+      AsciiPrint("Write file error %r\n", Status);\r
       goto Exit;\r
     }    \r
   }\r
@@ -776,17 +779,18 @@ EblFileCopyCmd (
     \r
     Status = EfiRead(Source, Buffer, &Chunk);\r
     if (EFI_ERROR(Status)) {\r
-      AsciiPrint("Read file error\n");\r
+      AsciiPrint("Read file error %r\n", Status);\r
       goto Exit;\r
     }\r
 \r
     Status = EfiWrite(Destination, Buffer, &Chunk);\r
     if (EFI_ERROR(Status)) {\r
-      AsciiPrint("Write file error\n");\r
+      AsciiPrint("Write file error %r\n", Status);\r
       goto Exit;\r
     }    \r
   }\r
 \r
+\r
 Exit:\r
   if (Source != NULL) {\r
     Status = EfiClose(Source);\r
@@ -794,7 +798,6 @@ Exit:
       AsciiPrint("Source close error %r\n", Status);\r
     }\r
   }\r
-  \r
   if (Destination != NULL) {\r
     Status = EfiClose(Destination);\r
     if (EFI_ERROR(Status)) {\r