Hi there everyone,
After the recent changes to the FPC 2.6.1 compiler, the internal compiler error seems to have disappeared (for good, I hope

)
However, there seems to be a bug in the TsSpreadBIFF8Writer.WriteToFile procedure in the xlsbiff8.pas file used to create Excel 2003 files.
A error occurs on the line 'MemStream.Free' as seen in the code snippet below. The Excel file is created in spite of the error but I find it a little bothersome because it confuses the users of my application.
The error goes away once I commented out this line. But this means MemStream is created but not freed. Is this not a potential memory leak notwithstanding the fact that MemStream is reassigned to OleDocument.Stream?
{*******************************************************************
* TsSpreadBIFF8Writer.WriteToFile ()
*
* DESCRIPTION: Writes an Excel BIFF8 file to the disc
*
* The BIFF 8 writer overrides this method because
* BIFF 8 is written as an OLE document, and our
* current OLE document writing method involves:
*
* 1 - Writing the BIFF data to a memory stream
*
* 2 - Write the memory stream data to disk using
* COM functions
*
*******************************************************************}
procedure TsSpreadBIFF8Writer.WriteToFile(const AFileName: string;
AData: TsWorkbook; const AOverwriteExisting: Boolean);
var
MemStream: TMemoryStream;
OutputStorage: TOLEStorage;
OLEDocument: TOLEDocument;
begin
MemStream := TMemoryStream.Create;
OutputStorage := TOLEStorage.Create;
try
WriteToStream(MemStream, AData);
// Only one stream is necessary for any number of worksheets
OLEDocument.Stream := MemStream;
OutputStorage.WriteOLEFile(AFileName, OLEDocument, AOverwriteExisting, 'Workbook');
finally
//MemStream.Free; <======= Commented out by JD a potential memory leak ?
OutputStorage.Free;
end;
end;
Any thoughts, suggestions?
JD