From 121cef51d2c9b23660b197bde455cda25dad76fd Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 5 Nov 2010 17:14:04 +0000 Subject: [PATCH] * Some memory leak fixes from Vincent Snijders git-svn-id: trunk@16306 - --- packages/fcl-passrc/src/pastree.pp | 2 ++ packages/fcl-passrc/src/pparser.pp | 15 +++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/fcl-passrc/src/pastree.pp b/packages/fcl-passrc/src/pastree.pp index 409800bc06..027047e825 100644 --- a/packages/fcl-passrc/src/pastree.pp +++ b/packages/fcl-passrc/src/pastree.pp @@ -1440,6 +1440,8 @@ begin (e.g. in Constants) } if Assigned(VarType) then VarType.Release; + if Assigned(Expr) then + Expr.Release; inherited Destroy; end; diff --git a/packages/fcl-passrc/src/pparser.pp b/packages/fcl-passrc/src/pparser.pp index cae42fb126..1490282ce1 100644 --- a/packages/fcl-passrc/src/pparser.pp +++ b/packages/fcl-passrc/src/pparser.pp @@ -3093,16 +3093,15 @@ begin begin Variant := TPasVariant(CreateElement(TPasVariant, '', Parent)); Parent.Variants.Add(Variant); - Variant.Values := TStringList.Create; while True do begin - Variant.Values.Add(ParseExpression(Parent)); - NextToken; - if CurToken = tkColon then - break - else if CurToken <> tkComma then - ParseExc(SParserExpectedCommaColon); - end; + Variant.Values.Add(ParseExpression(Parent)); + NextToken; + if CurToken = tkColon then + break + else if CurToken <> tkComma then + ParseExc(SParserExpectedCommaColon); + end; ExpectToken(tkBraceOpen); Variant.Members := TPasRecordType(CreateElement(TPasRecordType, '', Variant));