}\r
\r
VOID\r
-Ascii2UnicodeWriteString (\r
+Ascii2UnicodeString (\r
CHAR8 *String,\r
- FILE *OutFile\r
+ CHAR16 *UniString\r
)\r
/*++\r
\r
\r
Arguments:\r
\r
- String - Pointer to string that is written to FILE.\r
- OutFile - Pointer to FILE\r
+ String - Pointer to string that is written to FILE.\r
+ UniString - Pointer to unicode string\r
\r
Returns:\r
\r
\r
--*/\r
{\r
- UINT32 Index;\r
- UINT8 AsciiNull;\r
-\r
- AsciiNull = 0;\r
-\r
+ while (*String != '\0') {\r
+ *(UniString++) = (CHAR16) *(String++);\r
+ }\r
//\r
- // Next, write out the string... Convert ASCII to Unicode in the process.\r
+ // End the UniString with a NULL.\r
//\r
- Index = 0;\r
- do {\r
- fwrite (&String[Index], 1, 1, OutFile);\r
- fwrite (&AsciiNull, 1, 1, OutFile);\r
- } while (String[Index++] != 0);\r
+ *UniString = '\0';\r
} \r
\r
STATUS\r
CHAR8 **InputFileName,\r
UINT32 InputFileNum,\r
UINT8 SectionType,\r
- FILE *OutFile\r
+ UINT8 **OutFileBuffer\r
)\r
/*++\r
\r
\r
SectionType - A valid section type string\r
\r
- OutFile - Output file handle\r
+ OutFileBuffer - Buffer pointer to Output file contents\r
\r
Returns:\r
\r
FILE *InFile;\r
UINT8 *Buffer;\r
UINT32 TotalLength;\r
- EFI_COMMON_SECTION_HEADER CommonSect;\r
+ EFI_COMMON_SECTION_HEADER *CommonSect;\r
STATUS Status;\r
\r
if (InputFileNum > 1) {\r
InputFileLength = ftell (InFile);\r
fseek (InFile, 0, SEEK_SET);\r
DebugMsg (NULL, 0, 9, "Input file", "File name is %s and File size is %d bytes", InputFileName[0], InputFileLength);\r
- //\r
- // Fill in the fields in the local section header structure\r
- //\r
- CommonSect.Type = (EFI_SECTION_TYPE) SectionType;\r
- TotalLength = sizeof (CommonSect) + InputFileLength;\r
+ TotalLength = sizeof (EFI_COMMON_SECTION_HEADER) + InputFileLength;\r
//\r
// Size must fit in 3 bytes\r
//\r
}\r
VerboseMsg ("the size of the created section file is %d bytes", TotalLength);\r
//\r
- // Now copy the size into the section header and write out the section header\r
+ // Fill in the fields in the local section header structure\r
//\r
- memcpy (&CommonSect.Size, &TotalLength, 3);\r
- fwrite (&CommonSect, sizeof (CommonSect), 1, OutFile);\r
+ Buffer = (UINT8 *) malloc ((size_t) TotalLength);\r
+ if (Buffer == NULL) {\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated"); \r
+ goto Done;\r
+ }\r
+ CommonSect = (EFI_COMMON_SECTION_HEADER *) Buffer;\r
+ CommonSect->Type = SectionType;\r
+ CommonSect->Size[0] = (UINT8) (TotalLength & 0xff);\r
+ CommonSect->Size[1] = (UINT8) ((TotalLength & 0xff00) >> 8);\r
+ CommonSect->Size[2] = (UINT8) ((TotalLength & 0xff0000) >> 16);\r
+ \r
//\r
- // Allocate a buffer to read in the contents of the input file. Then\r
- // read it in as one block and write it to the output file.\r
+ // read data from the input file.\r
//\r
if (InputFileLength != 0) {\r
- Buffer = (UINT8 *) malloc ((size_t) InputFileLength);\r
- if (Buffer == NULL) {\r
- Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated"); \r
- goto Done;\r
- }\r
-\r
- if (fread (Buffer, (size_t) InputFileLength, 1, InFile) != 1) {\r
+ if (fread (Buffer + sizeof (EFI_COMMON_SECTION_HEADER), (size_t) InputFileLength, 1, InFile) != 1) {\r
Error (NULL, 0, 0004, "Error reading file", InputFileName[0]);\r
goto Done;\r
}\r
-\r
- if (fwrite (Buffer, (size_t) InputFileLength, 1, OutFile) != 1) {\r
- Error (NULL, 0, 0002, "Error writing file", NULL);\r
- goto Done;\r
- }\r
}\r
\r
+ //\r
+ // Set OutFileBuffer \r
+ //\r
+ *OutFileBuffer = Buffer;\r
Status = STATUS_SUCCESS;\r
\r
Done:\r
fclose (InFile);\r
- if (Buffer != NULL) {\r
- free (Buffer);\r
- }\r
\r
return Status;\r
}\r
\r
EFI_STATUS\r
GenSectionCompressionSection (\r
- CHAR8 **InputFileName,\r
+ CHAR8 **InputFileName,\r
UINT32 InputFileNum,\r
UINT8 SectCompSubType,\r
- FILE *OutFile\r
+ UINT8 **OutFileBuffer\r
)\r
/*++\r
\r
\r
SectCompSubType - Specify the compression algorithm requested. \r
\r
- OutFile - Output file handle\r
+ OutFileBuffer - Buffer pointer to Output file contents\r
\r
Returns:\r
\r
UINT8 *FileBuffer;\r
UINT8 *OutputBuffer;\r
EFI_STATUS Status;\r
- EFI_COMPRESSION_SECTION CompressionSect;\r
+ EFI_COMPRESSION_SECTION *CompressionSect;\r
COMPRESS_FUNCTION CompressFunction;\r
\r
InputLength = 0;\r
\r
Status = CompressFunction (FileBuffer, InputLength, OutputBuffer, &CompressedLength);\r
if (Status == EFI_BUFFER_TOO_SMALL) {\r
- OutputBuffer = malloc (CompressedLength);\r
+ OutputBuffer = malloc (CompressedLength + sizeof (EFI_COMPRESSION_SECTION));\r
if (!OutputBuffer) {\r
free (FileBuffer);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- Status = CompressFunction (FileBuffer, InputLength, OutputBuffer, &CompressedLength);\r
+ Status = CompressFunction (FileBuffer, InputLength, OutputBuffer + sizeof (EFI_COMPRESSION_SECTION), &CompressedLength);\r
}\r
\r
free (FileBuffer);\r
//\r
// Add the section header for the compressed data\r
//\r
- CompressionSect.CommonHeader.Type = EFI_SECTION_COMPRESSION;\r
- CompressionSect.CommonHeader.Size[0] = (UINT8) (TotalLength & 0xff);\r
- CompressionSect.CommonHeader.Size[1] = (UINT8) ((TotalLength & 0xff00) >> 8);\r
- CompressionSect.CommonHeader.Size[2] = (UINT8) ((TotalLength & 0xff0000) >> 16);\r
- CompressionSect.CompressionType = SectCompSubType;\r
- CompressionSect.UncompressedLength = InputLength;\r
-\r
- fwrite (&CompressionSect, sizeof (CompressionSect), 1, OutFile);\r
- fwrite (FileBuffer, CompressedLength, 1, OutFile);\r
- free (FileBuffer);\r
+ CompressionSect = (EFI_COMPRESSION_SECTION *) FileBuffer;\r
+ \r
+ CompressionSect->CommonHeader.Type = EFI_SECTION_COMPRESSION;\r
+ CompressionSect->CommonHeader.Size[0] = (UINT8) (TotalLength & 0xff);\r
+ CompressionSect->CommonHeader.Size[1] = (UINT8) ((TotalLength & 0xff00) >> 8);\r
+ CompressionSect->CommonHeader.Size[2] = (UINT8) ((TotalLength & 0xff0000) >> 16);\r
+ CompressionSect->CompressionType = SectCompSubType;\r
+ CompressionSect->UncompressedLength = InputLength;\r
+\r
+ //\r
+ // Set OutFileBuffer \r
+ //\r
+ *OutFileBuffer = FileBuffer;\r
+\r
return EFI_SUCCESS;\r
}\r
\r
EFI_GUID *VendorGuid,\r
UINT16 DataAttribute,\r
UINT32 DataHeaderSize,\r
- FILE *OutFile\r
+ UINT8 **OutFileBuffer\r
)\r
/*++\r
\r
\r
DataHeaderSize- Guided Data Header Size\r
\r
- OutFile - Output file handle\r
+ OutFileBuffer - Buffer pointer to Output file contents\r
\r
Returns:\r
\r
{\r
UINT32 TotalLength;\r
UINT32 InputLength;\r
+ UINT32 Offset;\r
UINT8 *FileBuffer;\r
UINT32 Crc32Checksum;\r
EFI_STATUS Status;\r
- CRC32_SECTION_HEADER Crc32GuidSect;\r
- EFI_GUID_DEFINED_SECTION VendorGuidSect;\r
+ CRC32_SECTION_HEADER *Crc32GuidSect;\r
+ EFI_GUID_DEFINED_SECTION *VendorGuidSect;\r
\r
InputLength = 0;\r
+ Offset = 0;\r
FileBuffer = NULL;\r
+\r
+ if (CompareGuid (VendorGuid, &mEfiCrc32SectionGuid) == 0) {\r
+ Offset = sizeof (CRC32_SECTION_HEADER);\r
+ } else {\r
+ Offset = sizeof (EFI_GUID_DEFINED_SECTION);\r
+ }\r
+\r
//\r
// read all input file contents into a buffer\r
// first get the size of all file contents\r
);\r
\r
if (Status == EFI_BUFFER_TOO_SMALL) {\r
- FileBuffer = (UINT8 *) malloc (InputLength);\r
+ FileBuffer = (UINT8 *) malloc (InputLength + Offset);\r
if (FileBuffer == NULL) {\r
Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated");\r
return EFI_OUT_OF_RESOURCES;\r
Status = GetSectionContents (\r
InputFileName,\r
InputFileNum,\r
- FileBuffer,\r
+ FileBuffer + Offset,\r
&InputLength\r
);\r
}\r
}\r
\r
//\r
- // Now data is in FileBuffer\r
+ // Now data is in FileBuffer + Offset\r
//\r
if (CompareGuid (VendorGuid, &mEfiCrc32SectionGuid) == 0) {\r
//\r
// Default Guid section is CRC32.\r
//\r
Crc32Checksum = 0;\r
- CalculateCrc32 (FileBuffer, InputLength, &Crc32Checksum);\r
+ CalculateCrc32 (FileBuffer + Offset, InputLength, &Crc32Checksum);\r
\r
TotalLength = InputLength + sizeof (CRC32_SECTION_HEADER);\r
if (TotalLength >= MAX_SECTION_SIZE) {\r
free (FileBuffer);\r
return STATUS_ERROR;\r
}\r
-\r
- Crc32GuidSect.GuidSectionHeader.CommonHeader.Type = EFI_SECTION_GUID_DEFINED;\r
- Crc32GuidSect.GuidSectionHeader.CommonHeader.Size[0] = (UINT8) (TotalLength & 0xff);\r
- Crc32GuidSect.GuidSectionHeader.CommonHeader.Size[1] = (UINT8) ((TotalLength & 0xff00) >> 8);\r
- Crc32GuidSect.GuidSectionHeader.CommonHeader.Size[2] = (UINT8) ((TotalLength & 0xff0000) >> 16);\r
- memcpy (&(Crc32GuidSect.GuidSectionHeader.SectionDefinitionGuid), &mEfiCrc32SectionGuid, sizeof (EFI_GUID));\r
- Crc32GuidSect.GuidSectionHeader.Attributes = EFI_GUIDED_SECTION_AUTH_STATUS_VALID;\r
- Crc32GuidSect.GuidSectionHeader.DataOffset = sizeof (CRC32_SECTION_HEADER);\r
- Crc32GuidSect.CRC32Checksum = Crc32Checksum;\r
- fwrite (&Crc32GuidSect, sizeof (Crc32GuidSect), 1, OutFile); \r
+ \r
+ Crc32GuidSect = (CRC32_SECTION_HEADER *) FileBuffer;\r
+ Crc32GuidSect->GuidSectionHeader.CommonHeader.Type = EFI_SECTION_GUID_DEFINED;\r
+ Crc32GuidSect->GuidSectionHeader.CommonHeader.Size[0] = (UINT8) (TotalLength & 0xff);\r
+ Crc32GuidSect->GuidSectionHeader.CommonHeader.Size[1] = (UINT8) ((TotalLength & 0xff00) >> 8);\r
+ Crc32GuidSect->GuidSectionHeader.CommonHeader.Size[2] = (UINT8) ((TotalLength & 0xff0000) >> 16);\r
+ memcpy (&(Crc32GuidSect->GuidSectionHeader.SectionDefinitionGuid), &mEfiCrc32SectionGuid, sizeof (EFI_GUID));\r
+ Crc32GuidSect->GuidSectionHeader.Attributes = EFI_GUIDED_SECTION_AUTH_STATUS_VALID;\r
+ Crc32GuidSect->GuidSectionHeader.DataOffset = sizeof (CRC32_SECTION_HEADER);\r
+ Crc32GuidSect->CRC32Checksum = Crc32Checksum;\r
+ DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %d", Crc32GuidSect->GuidSectionHeader.DataOffset);\r
\r
} else {\r
TotalLength = InputLength + sizeof (EFI_GUID_DEFINED_SECTION);\r
return STATUS_ERROR;\r
}\r
\r
- VendorGuidSect.CommonHeader.Type = EFI_SECTION_GUID_DEFINED;\r
- VendorGuidSect.CommonHeader.Size[0] = (UINT8) (TotalLength & 0xff);\r
- VendorGuidSect.CommonHeader.Size[1] = (UINT8) ((TotalLength & 0xff00) >> 8);\r
- VendorGuidSect.CommonHeader.Size[2] = (UINT8) ((TotalLength & 0xff0000) >> 16);\r
- memcpy (&(VendorGuidSect.SectionDefinitionGuid), VendorGuid, sizeof (EFI_GUID));\r
- VendorGuidSect.Attributes = DataAttribute;\r
- VendorGuidSect.DataOffset = sizeof (EFI_GUID_DEFINED_SECTION) + DataHeaderSize;\r
- fwrite (&VendorGuidSect, sizeof (EFI_GUID_DEFINED_SECTION), 1, OutFile); \r
- DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %d", VendorGuidSect.DataOffset);\r
+ VendorGuidSect = (EFI_GUID_DEFINED_SECTION *) FileBuffer;\r
+ VendorGuidSect->CommonHeader.Type = EFI_SECTION_GUID_DEFINED;\r
+ VendorGuidSect->CommonHeader.Size[0] = (UINT8) (TotalLength & 0xff);\r
+ VendorGuidSect->CommonHeader.Size[1] = (UINT8) ((TotalLength & 0xff00) >> 8);\r
+ VendorGuidSect->CommonHeader.Size[2] = (UINT8) ((TotalLength & 0xff0000) >> 16);\r
+ memcpy (&(VendorGuidSect->SectionDefinitionGuid), VendorGuid, sizeof (EFI_GUID));\r
+ VendorGuidSect->Attributes = DataAttribute;\r
+ VendorGuidSect->DataOffset = sizeof (EFI_GUID_DEFINED_SECTION) + DataHeaderSize;\r
+ DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %d", VendorGuidSect->DataOffset);\r
}\r
VerboseMsg ("the size of the created section file is %d bytes", TotalLength);\r
-\r
- fwrite (FileBuffer, InputLength, 1, OutFile);\r
- free (FileBuffer);\r
\r
+ //\r
+ // Set OutFileBuffer \r
+ //\r
+ *OutFileBuffer = FileBuffer;\r
+\r
return EFI_SUCCESS;\r
}\r
\r
UINT8 SectCompSubType;\r
UINT16 SectGuidAttribute; \r
UINT64 SectGuidHeaderLength;\r
- EFI_COMMON_SECTION_HEADER CommonSect;\r
+ EFI_VERSION_SECTION *VersionSect;\r
+ EFI_USER_INTERFACE_SECTION *UiSect;\r
UINT32 InputLength;\r
- UINT8 *FileBuffer;\r
+ UINT8 *OutFileBuffer;\r
+ UINT8 *TempBuffer;\r
+ UINT32 TempLength;\r
EFI_STATUS Status;\r
UINT64 LogLevel;\r
\r
SectType = EFI_SECTION_ALL;\r
SectCompSubType = 0;\r
SectGuidAttribute = 0;\r
- FileBuffer = NULL;\r
+ OutFileBuffer = NULL;\r
InputLength = 0;\r
Status = STATUS_SUCCESS;\r
LogLevel = 0;\r
SectGuidHeaderLength = 0;\r
+ VersionSect = NULL;\r
+ UiSect = NULL;\r
+ TempBuffer = NULL;\r
\r
SetUtilityName (UTILITY_NAME);\r
\r
}\r
VerboseMsg ("Output file name is %s", OutputFileName);\r
\r
- //\r
- // Open output file\r
- //\r
- OutFile = fopen (OutputFileName, "wb");\r
- if (OutFile == NULL) {\r
- Error (NULL, 0, 0001, "Error opening file", OutputFileName);\r
- goto Finish;\r
- }\r
- \r
//\r
// At this point, we've fully validated the command line, and opened appropriate\r
// files, so let's go and do what we've been asked to do...\r
InputFileName,\r
InputFileNum,\r
SectCompSubType,\r
- OutFile\r
+ &OutFileBuffer\r
);\r
break;\r
\r
&VendorGuid,\r
SectGuidAttribute,\r
(UINT32) SectGuidHeaderLength,\r
- OutFile\r
+ &OutFileBuffer\r
);\r
break;\r
\r
case EFI_SECTION_VERSION:\r
- CommonSect.Type = (EFI_SECTION_TYPE) SectType;\r
-\r
- Index = sizeof (CommonSect);\r
+ Index = sizeof (EFI_COMMON_SECTION_HEADER);\r
//\r
// 2 bytes for the build number UINT16\r
//\r
// StringBuffer is ascii.. unicode is 2X + 2 bytes for terminating unicode null.\r
//\r
Index += (strlen (StringBuffer) * 2) + 2;\r
- memcpy (&CommonSect.Size, &Index, 3);\r
- fwrite (&CommonSect, sizeof (CommonSect), 1, OutFile);\r
- fwrite (&VersionNumber, sizeof (UINT16), 1, OutFile);\r
- Ascii2UnicodeWriteString (StringBuffer, OutFile);\r
+ OutFileBuffer = (UINT8 *) malloc (Index);\r
+ if (OutFileBuffer == NULL) {\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated");\r
+ goto Finish;\r
+ }\r
+ VersionSect = (EFI_VERSION_SECTION *) OutFileBuffer;\r
+ VersionSect->CommonHeader.Type = SectType;\r
+ VersionSect->CommonHeader.Size[0] = (UINT8) (Index & 0xff);\r
+ VersionSect->CommonHeader.Size[1] = (UINT8) ((Index & 0xff00) >> 8);\r
+ VersionSect->CommonHeader.Size[2] = (UINT8) ((Index & 0xff0000) >> 16);\r
+ VersionSect->BuildNumber = (UINT16) VersionNumber;\r
+ Ascii2UnicodeString (StringBuffer, VersionSect->VersionString);\r
VerboseMsg ("the size of the created section file is %d bytes", Index);\r
break;\r
\r
case EFI_SECTION_USER_INTERFACE:\r
- CommonSect.Type = (EFI_SECTION_TYPE) SectType;\r
- Index = sizeof (CommonSect);\r
+ Index = sizeof (EFI_COMMON_SECTION_HEADER);\r
//\r
// StringBuffer is ascii.. unicode is 2X + 2 bytes for terminating unicode null.\r
//\r
Index += (strlen (StringBuffer) * 2) + 2;\r
- memcpy (&CommonSect.Size, &Index, 3);\r
- fwrite (&CommonSect, sizeof (CommonSect), 1, OutFile);\r
- Ascii2UnicodeWriteString (StringBuffer, OutFile);\r
+ OutFileBuffer = (UINT8 *) malloc (Index);\r
+ if (OutFileBuffer == NULL) {\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated");\r
+ goto Finish;\r
+ }\r
+ UiSect = (EFI_USER_INTERFACE_SECTION *) OutFileBuffer;\r
+ UiSect->CommonHeader.Type = SectType;\r
+ UiSect->CommonHeader.Size[0] = (UINT8) (Index & 0xff);\r
+ UiSect->CommonHeader.Size[1] = (UINT8) ((Index & 0xff00) >> 8);\r
+ UiSect->CommonHeader.Size[2] = (UINT8) ((Index & 0xff0000) >> 16);\r
+ Ascii2UnicodeString (StringBuffer, UiSect->FileNameString);\r
VerboseMsg ("the size of the created section file is %d bytes", Index);\r
- break;\r
+ break;\r
\r
case EFI_SECTION_ALL:\r
//\r
Status = GetSectionContents (\r
InputFileName,\r
InputFileNum,\r
- FileBuffer,\r
+ OutFileBuffer,\r
&InputLength\r
);\r
\r
if (Status == EFI_BUFFER_TOO_SMALL) {\r
- FileBuffer = (UINT8 *) malloc (InputLength);\r
- if (FileBuffer == NULL) {\r
+ OutFileBuffer = (UINT8 *) malloc (InputLength);\r
+ if (OutFileBuffer == NULL) {\r
Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated");\r
goto Finish;\r
}\r
Status = GetSectionContents (\r
InputFileName,\r
InputFileNum,\r
- FileBuffer,\r
+ OutFileBuffer,\r
&InputLength\r
);\r
}\r
- \r
- if (Status == EFI_SUCCESS) {\r
- fwrite (FileBuffer, InputLength, 1, OutFile);\r
- }\r
-\r
- if (FileBuffer != NULL) {\r
- free (FileBuffer);\r
- }\r
VerboseMsg ("the size of the created section file is %d bytes", InputLength);\r
break;\r
default:\r
InputFileName,\r
InputFileNum,\r
SectType,\r
- OutFile\r
+ &OutFileBuffer\r
);\r
break;\r
}\r
+ \r
+ //\r
+ // Get output file length\r
+ //\r
+ if (SectType != EFI_SECTION_ALL) {\r
+ InputLength = SECTION_SIZE (OutFileBuffer);\r
+ }\r
+ //\r
+ // Write the Buffer to the Output file.\r
+ //\r
+ OutFile = fopen (OutputFileName, "rb");\r
+ if (OutFile != NULL) {\r
+ //\r
+ // the output file exists\r
+ // first compare the output buffer and the exist output file \r
+ // if same, not to update output file\r
+ //\r
+ fseek (OutFile, 0, SEEK_END);\r
+ TempLength = ftell (OutFile);\r
+ fseek (OutFile, 0, SEEK_SET);\r
+\r
+ if (InputLength != TempLength) {\r
+ //\r
+ // they can't be same because their size are different\r
+ //\r
+ goto WriteFile;\r
+ }\r
+ //\r
+ // read file data from output file\r
+ //\r
+ TempBuffer = (UINT8 *) malloc (TempLength);\r
+ if (TempBuffer == NULL) {\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated");\r
+ goto Finish;\r
+ }\r
+ fread (TempBuffer, TempLength, 1, OutFile);\r
+ //\r
+ // Compare Data byte by byte\r
+ //\r
+ for (Index = 0; Index < InputLength; Index ++) {\r
+ if (OutFileBuffer [Index] != TempBuffer [Index]) {\r
+ break;\r
+ }\r
+ }\r
+ //\r
+ // Data is same, output file doesn't need to be updated.\r
+ //\r
+ if (Index >= InputLength) {\r
+ goto Finish;\r
+ }\r
+ }\r
+\r
+WriteFile:\r
+ if (OutFile != NULL) {\r
+ fclose (OutFile);\r
+ }\r
+\r
+ OutFile = fopen (OutputFileName, "wb");\r
+ if (OutFile == NULL) {\r
+ Error (NULL, 0, 0001, "Error opening file for writing", OutputFileName);\r
+ goto Finish;\r
+ }\r
+\r
+ fwrite (OutFileBuffer, InputLength, 1, OutFile);\r
\r
Finish:\r
if (InputFileName != NULL) {\r
free (InputFileName);\r
}\r
+ \r
+ if (TempBuffer != NULL) {\r
+ free (TempBuffer);\r
+ }\r
+\r
+ if (OutFileBuffer != NULL) {\r
+ free (OutFileBuffer);\r
+ }\r
\r
if (OutFile != NULL) {\r
fclose (OutFile);\r