* moved the check in FloodFill whether x,y are within the current viewport in

the beginning, before any heap memory allocations, to avoid memory leaks when
  FloodFill is invoked with a point that is outside the current viewport

git-svn-id: trunk@40965 -
This commit is contained in:
nickysn 2019-01-21 14:50:26 +00:00
parent e6835e8ff7
commit 92304ce573

View File

@ -434,6 +434,8 @@ var
BackupColor : ColorType;
x1, x2, prevy: smallint;
Begin
If (x<0) Or (y<0) Or
(x>ViewWidth) Or (y>ViewHeight) then Exit;
GetMem(DrawnList,sizeof(PFloodLine)*((ViewHeight div YResDiv) + 1));
if not assigned(DrawnList) then
begin
@ -466,8 +468,6 @@ var
_GraphResult := grNoFloodMem;
exit;
end;
If (x<0) Or (y<0) Or
(x>ViewWidth) Or (y>ViewHeight) then Exit;
{ Index of points to check }
Buffer.WordIndex:=0;
PushPoint (x,y);