mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 20:26:00 +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;
|
BackupColor : ColorType;
|
||||||
x1, x2, prevy: smallint;
|
x1, x2, prevy: smallint;
|
||||||
Begin
|
Begin
|
||||||
|
If (x<0) Or (y<0) Or
|
||||||
|
(x>ViewWidth) Or (y>ViewHeight) then Exit;
|
||||||
GetMem(DrawnList,sizeof(PFloodLine)*((ViewHeight div YResDiv) + 1));
|
GetMem(DrawnList,sizeof(PFloodLine)*((ViewHeight div YResDiv) + 1));
|
||||||
if not assigned(DrawnList) then
|
if not assigned(DrawnList) then
|
||||||
begin
|
begin
|
||||||
@ -466,8 +468,6 @@ var
|
|||||||
_GraphResult := grNoFloodMem;
|
_GraphResult := grNoFloodMem;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
If (x<0) Or (y<0) Or
|
|
||||||
(x>ViewWidth) Or (y>ViewHeight) then Exit;
|
|
||||||
{ Index of points to check }
|
{ Index of points to check }
|
||||||
Buffer.WordIndex:=0;
|
Buffer.WordIndex:=0;
|
||||||
PushPoint (x,y);
|
PushPoint (x,y);
|
||||||
|
Loading…
Reference in New Issue
Block a user