mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 16:29:32 +02:00
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:
parent
391ed314a8
commit
f181d04615
@ -513,7 +513,7 @@ end;
|
|||||||
|
|
||||||
procedure TPicture.SaveToFile(const Filename: string; const FileExt: string = '');
|
procedure TPicture.SaveToFile(const Filename: string; const FileExt: string = '');
|
||||||
var
|
var
|
||||||
Ext, F: string;
|
Ext: string;
|
||||||
Stream: TStream;
|
Stream: TStream;
|
||||||
begin
|
begin
|
||||||
if FileExt <> '' then
|
if FileExt <> '' then
|
||||||
|
@ -2927,6 +2927,14 @@ begin
|
|||||||
if FMaskLineStarts <> nil then Dispose(FMaskLineStarts);
|
if FMaskLineStarts <> nil then Dispose(FMaskLineStarts);
|
||||||
FMaskLineStarts := nil;
|
FMaskLineStarts := nil;
|
||||||
FMaskSet := False;
|
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;
|
end;
|
||||||
|
|
||||||
procedure TLazIntfImage.CreateData;
|
procedure TLazIntfImage.CreateData;
|
||||||
|
Loading…
Reference in New Issue
Block a user