From 042ab4826ae2bca68f24e0582e302eb0e3c09e2c Mon Sep 17 00:00:00 2001 From: zeljko Date: Sat, 22 Dec 2018 09:43:31 +0000 Subject: [PATCH] LCL: TCustomImageList fix for memory leak. Patch by Ondrej Pokorny. issue #34708 git-svn-id: trunk@59892 - --- lcl/include/imglist.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lcl/include/imglist.inc b/lcl/include/imglist.inc index af618c00a9..f7c67fe89e 100644 --- a/lcl/include/imglist.inc +++ b/lcl/include/imglist.inc @@ -326,9 +326,9 @@ begin if n <> 0 then Inc(ACount, FImageList.FAllocBy - n); - SetLength(FData, ACount * FWidth * FHeight * SizeOf(FData[0])); + SetLength(FData, ACount * FWidth * FHeight); - Inc(FAllocCount, ACount); + FAllocCount := ACount; end; procedure TCustomImageListResolution.CheckIndex(AIndex: Integer; @@ -1461,7 +1461,7 @@ begin ToR.AllocData(ToR.FCount); if ToR.FCount>0 then begin - DataSize := ToR.FWidth * ToR.FHeight * SizeOf(FData[0]); + DataSize := ToR.FWidth * ToR.FHeight * SizeOf(ToR.FData[0]); System.Move(FromR.FData[0], ToR.FData[0], ToR.FCount * DataSize); end; end;