if (CompareGuid ((EFI_GUID *) FileBuffer, &mFileGuidArray [Index1]) == 0) {\r
Error (NULL, 0, 2000, "Invalid parameter", "the %dth file and %uth file have the same file GUID.", (unsigned) Index1 + 1, (unsigned) Index + 1);\r
PrintGuid ((EFI_GUID *) FileBuffer);\r
+ free (FileBuffer);\r
return EFI_INVALID_PARAMETER;\r
}\r
}\r
//\r
Status = CalculateFvSize (&mFvDataInfo);\r
if (EFI_ERROR (Status)) {\r
- return Status; \r
+ goto Finish;\r
}\r
VerboseMsg ("the generated FV image size is %u bytes", (unsigned) mFvDataInfo.Size);\r
\r
//\r
FvBufferHeader = malloc (FvImageSize + sizeof (UINT64));\r
if (FvBufferHeader == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto Finish;\r
}\r
FvImage = (UINT8 *) (((UINTN) FvBufferHeader + 7) & ~7);\r
\r
FvMapFile = fopen (LongFilePath (FvMapName), "w");\r
if (FvMapFile == NULL) {\r
Error (NULL, 0, 0001, "Error opening file", FvMapName);\r
- return EFI_ABORTED;\r
+ Status = EFI_ABORTED;\r
+ goto Finish;\r
}\r
\r
//\r
FvReportFile = fopen (LongFilePath (FvReportName), "w");\r
if (FvReportFile == NULL) {\r
Error (NULL, 0, 0001, "Error opening file", FvReportName);\r
- return EFI_ABORTED;\r
+ Status = EFI_ABORTED;\r
+ goto Finish;\r
}\r
//\r
// record FV size information into FvMap file.\r
\r
fwrite (CapBuffer, 1, CapSize, fpout);\r
fclose (fpout);\r
+ free (CapBuffer);\r
\r
VerboseMsg ("The size of the generated capsule image is %u bytes", (unsigned) CapSize);\r
\r