Changeset 67 for trunk/Compiler/Analyze


Ignore:
Timestamp:
Jul 19, 2012, 8:44:08 AM (12 years ago)
Author:
chronos
Message:
  • Fixed: Memory leaks in expression analyze.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Compiler/Analyze/UAnalyzerPascal.pas

    r65 r67  
    155155  try
    156156    Expressions := TListExpression.Create;
    157     Expressions.OwnsObjects := False;
    158157    Expressions.Add(TExpression.Create);
    159158    with SourceCode do begin
     
    180179            TExpression(Expressions[I - 1]).SubItems.Last := Expressions[I];
    181180            TExpression(Expressions[I + 1]).SubItems.First := Expressions[I];
     181            Expressions.OwnsObjects := False;
     182            Expressions[I] := nil;
     183            Expressions.OwnsObjects := True;
    182184            Expressions.Delete(I);
    183185          end else Inc(I);
    184186        end;
    185187      end;
    186       if Assigned(TExpression(Expressions.First).SubItems.Last) then
     188      if Assigned(TExpression(Expressions.First).SubItems.Last) then begin
    187189        Assign(TExpression(TExpression(Expressions.First).SubItems.Last));
     190        SubItems.OwnsObjects := True;
     191        TExpression(TExpression(Expressions.First).SubItems.Last).SubItems.OwnsObjects := False;
     192        TExpression(Expressions.First).SubItems.Last.Free;
     193      end;
    188194      TExpression(Expressions.First).SubItems.Last := nil;
    189195      if Expressions.Count > 1 then
Note: See TracChangeset for help on using the changeset viewer.