fcl-passrc: fixed free loop

git-svn-id: trunk@39438 -
This commit is contained in:
Mattias Gaertner 2018-07-11 21:34:15 +00:00
parent 620888b54e
commit c7e07a792c
2 changed files with 4 additions and 3 deletions

View File

@ -3833,10 +3833,10 @@ var
begin begin
inherited ForEachCall(aMethodCall, Arg); inherited ForEachCall(aMethodCall, Arg);
for i:=0 to GenericTemplateTypes.Count-1 do for i:=0 to GenericTemplateTypes.Count-1 do
ForEachChildCall(aMethodCall,Arg,TPasElement(GenericTemplateTypes[i]),false); ForEachChildCall(aMethodCall,Arg,TPasElement(GenericTemplateTypes[i]),true);
for i:=0 to Members.Count-1 do for i:=0 to Members.Count-1 do
ForEachChildCall(aMethodCall,Arg,TPasElement(Members[i]),false); ForEachChildCall(aMethodCall,Arg,TPasElement(Members[i]),false);
ForEachChildCall(aMethodCall,Arg,VariantEl,false); ForEachChildCall(aMethodCall,Arg,VariantEl,true);
if Variants<>nil then if Variants<>nil then
for i:=0 to Variants.Count-1 do for i:=0 to Variants.Count-1 do
ForEachChildCall(aMethodCall,Arg,TPasElement(Variants[i]),false); ForEachChildCall(aMethodCall,Arg,TPasElement(Variants[i]),false);
@ -4723,7 +4723,7 @@ procedure TPasImplExceptOn.ForEachCall(const aMethodCall: TOnForEachPasElement;
const Arg: Pointer); const Arg: Pointer);
begin begin
ForEachChildCall(aMethodCall,Arg,VarEl,false); ForEachChildCall(aMethodCall,Arg,VarEl,false);
ForEachChildCall(aMethodCall,Arg,TypeEl,false); ForEachChildCall(aMethodCall,Arg,TypeEl,true);
if Elements.IndexOf(Body)<0 then if Elements.IndexOf(Body)<0 then
ForEachChildCall(aMethodCall,Arg,Body,false); ForEachChildCall(aMethodCall,Arg,Body,false);
inherited ForEachCall(aMethodCall, Arg); inherited ForEachCall(aMethodCall, Arg);

View File

@ -587,6 +587,7 @@ var
s: String; s: String;
begin begin
l := CurPos - Start; l := CurPos - Start;
s:='';
SetLength(s, l); SetLength(s, l);
if l > 0 then if l > 0 then
Move(Start^, s[1], l) Move(Start^, s[1], l)