[fpc-devel] mem-leak in TStrings.SaveToFile?

Michael Van Canneyt michael at freepascal.org
Fri Feb 12 14:51:35 CET 2010



On Fri, 12 Feb 2010, Joost van der Sluis wrote:

> Hi all,
>
> See here the code from TStrings.SaveToFile:
>
> Procedure TStrings.SaveToFile(const FileName: string);
>
> Var TheStream : TFileStream;
>
> begin
>  TheStream:=TFileStream.Create(FileName,fmCreate);
>  SaveToStream(TheStream);
>  TheStream.Free;
> end
>
> Doesn't this leak memory when the file is locked, for example? And is is
> allowed to add the 'try .. finally' here? (It's in objpas/classes so
> that should be possible?)

It *must* be there :)

Michael.



More information about the fpc-devel mailing list