If the capsule from command line is not present,
Buffer will be random value when freeing it in DumpCapsule(),
then ASSERT will happen or other memory pool may be freed.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
/** @file\r
Dump Capsule image information.\r
\r
/** @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
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
EFI_CAPSULE_HEADER *CapsuleHeader;\r
EFI_STATUS Status;\r
\r
EFI_CAPSULE_HEADER *CapsuleHeader;\r
EFI_STATUS Status;\r
\r
Status = ReadFileToBuffer(CapsuleName, &FileSize, &Buffer);\r
if (EFI_ERROR(Status)) {\r
Print(L"CapsuleApp: Capsule (%s) is not found.\n", CapsuleName);\r
Status = ReadFileToBuffer(CapsuleName, &FileSize, &Buffer);\r
if (EFI_ERROR(Status)) {\r
Print(L"CapsuleApp: Capsule (%s) is not found.\n", CapsuleName);\r
+ if (Buffer != NULL) {\r
+ FreePool(Buffer);\r
+ }\r