mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 15:49:26 +02:00
* 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:
parent
e6835e8ff7
commit
92304ce573
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user