LCL: fix mem-leak in TRasterImage.LoadFromRawImage Issue #0035372 / Behaviour change: if source and dest are equal, then data is kept as it is.

Previously new mem of the same size was allocated, but no data written to it. Previous behaviour appears to be buggy since it did NOT load anything, so new behaviour is fine.
(Only affects ADataOwner=False.)

git-svn-id: trunk@61202 -
This commit is contained in:
martin 2019-05-11 11:26:34 +00:00
parent 057100e30e
commit 76b9420caf

View File

@ -586,6 +586,9 @@ begin
if AImage.Description.Format = ricfNone then Exit; // empty image
img := GetRawImagePtr;
if img = @AImage then //copy to self => no op
exit;
img^.FreeData;
img^.Description := AImage.Description;
if ADataOwner
then begin