/** @file\r
Dump Capsule image information.\r
\r
- Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2016 - 2018, 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
// FMP GUID after ESRT one\r
//\r
NestedCapsuleHeader = (EFI_CAPSULE_HEADER *)((UINT8 *)CapsuleHeader + CapsuleHeader->HeaderSize);\r
- NestedCapsuleSize = (UINTN)CapsuleHeader + CapsuleHeader->HeaderSize - (UINTN)NestedCapsuleHeader;\r
+ NestedCapsuleSize = (UINTN)CapsuleHeader + CapsuleHeader->CapsuleImageSize- (UINTN)NestedCapsuleHeader;\r
if (NestedCapsuleSize < sizeof(EFI_CAPSULE_HEADER)) {\r
return FALSE;\r
}\r
EFI_CAPSULE_HEADER *CapsuleHeader;\r
EFI_STATUS Status;\r
\r
+ Buffer = NULL;\r
Status = ReadFileToBuffer(CapsuleName, &FileSize, &Buffer);\r
if (EFI_ERROR(Status)) {\r
Print(L"CapsuleApp: Capsule (%s) is not found.\n", CapsuleName);\r
}\r
\r
Done:\r
- FreePool(Buffer);\r
+ if (Buffer != NULL) {\r
+ FreePool(Buffer);\r
+ }\r
return Status;\r
}\r
\r
Print(L" FwVersion - 0x%x\n", EsrtEntry->FwVersion);\r
Print(L" LowestSupportedFwVersion - 0x%x\n", EsrtEntry->LowestSupportedFwVersion);\r
Print(L" CapsuleFlags - 0x%x\n", EsrtEntry->CapsuleFlags);\r
- Print(L" PERSIST_ACROSS_RESET - 0x%x\n", EsrtEntry->CapsuleFlags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET);\r
- Print(L" POPULATE_SYSTEM_TABLE - 0x%x\n", EsrtEntry->CapsuleFlags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE);\r
- Print(L" INITIATE_RESET - 0x%x\n", EsrtEntry->CapsuleFlags & CAPSULE_FLAGS_INITIATE_RESET);\r
Print(L" LastAttemptVersion - 0x%x\n", EsrtEntry->LastAttemptVersion);\r
Print(L" LastAttemptStatus - 0x%x (%a)\n", EsrtEntry->LastAttemptStatus, LastAttemptStatusToString(EsrtEntry->LastAttemptStatus));\r
}\r
Status = WriteFileFromBuffer(ImageName, ImageSize, Image);\r
Print(L"CapsuleApp: Dump %g ImageIndex (0x%x) to %s %r\n", ImageTypeId, ImageIndex, ImageName, Status);\r
\r
+ FreePool (Image);\r
+\r
return ;\r
}\r