Kaynağa Gözat

* fix memory leaks in create_dwarf and types_dec procedures thanks to Giulio Bernardi's detailed report

git-svn-id: trunk@11236 -
Almindor 17 yıl önce
ebeveyn
işleme
62205d0346
2 değiştirilmiş dosya ile 4 ekleme ve 3 silme
  1. 2 2
      compiler/pdecl.pas
  2. 2 1
      compiler/pmodules.pas

+ 2 - 2
compiler/pdecl.pas

@@ -574,11 +574,11 @@ implementation
                { Generic is never a type renaming }
                { Generic is never a type renaming }
                hdef.typesym:=newtype;
                hdef.typesym:=newtype;
              end;
              end;
+           if assigned(generictypelist) then
+             generictypelist.free;
          until token<>_ID;
          until token<>_ID;
          typecanbeforward:=false;
          typecanbeforward:=false;
          symtablestack.top.SymList.ForEachCall(@resolve_type_forward,nil);
          symtablestack.top.SymList.ForEachCall(@resolve_type_forward,nil);
-         if assigned(generictypelist) then
-           generictypelist.free;
          block_type:=old_block_type;
          block_type:=old_block_type;
       end;
       end;
 
 

+ 2 - 1
compiler/pmodules.pas

@@ -139,7 +139,8 @@ implementation
         if (tf_needs_dwarf_cfi in target_info.flags) and
         if (tf_needs_dwarf_cfi in target_info.flags) and
            (af_supports_dwarf in target_asm.flags) then
            (af_supports_dwarf in target_asm.flags) then
           begin
           begin
-            current_asmdata.asmlists[al_dwarf]:=TAsmList.create;
+            current_asmdata.asmlists[al_dwarf].Free;
+            current_asmdata.asmlists[al_dwarf] := TAsmList.create;
             current_asmdata.asmcfi.generate_code(current_asmdata.asmlists[al_dwarf]);
             current_asmdata.asmcfi.generate_code(current_asmdata.asmlists[al_dwarf]);
           end;
           end;
       end;
       end;