lcl: set FDataOwner to true in IntfImage after freeing data - fixes memory leak in the .ico reader

git-svn-id: trunk@15752 -
This commit is contained in:
paul 2008-07-11 16:49:57 +00:00
parent 391ed314a8
commit f181d04615
2 changed files with 9 additions and 1 deletions

View File

@ -513,7 +513,7 @@ end;
procedure TPicture.SaveToFile(const Filename: string; const FileExt: string = '');
var
Ext, F: string;
Ext: string;
Stream: TStream;
begin
if FileExt <> '' then

View File

@ -2927,6 +2927,14 @@ begin
if FMaskLineStarts <> nil then Dispose(FMaskLineStarts);
FMaskLineStarts := nil;
FMaskSet := False;
if FDataOwner
then ReallocMem(FRawImage.Palette, 0)
else FRawImage.Palette := nil;
FRawImage.PaletteSize := 0;
// old RawImage data has been cleared/destroyed => so new data must be owned by us
FDataOwner := True;
end;
procedure TLazIntfImage.CreateData;