Browse Source

* fix memory leaks

peter 20 years ago
parent
commit
ec4465234c
1 changed files with 6 additions and 2 deletions
  1. 6 2
      fcl/inc/inifiles.pp

+ 6 - 2
fcl/inc/inifiles.pp

@@ -512,6 +512,7 @@ begin
         // comment at the beginning of the ini file
         // comment at the beginning of the ini file
         oSection := TIniFileSection.Create(sLine);
         oSection := TIniFileSection.Create(sLine);
         FSectionList.Add(oSection);
         FSectionList.Add(oSection);
+        continue;
       end;
       end;
       if (Copy(sLine, 1, 1) = Brackets[0]) and (Copy(sLine, length(sLine), 1) = Brackets[1]) then begin
       if (Copy(sLine, 1, 1) = Brackets[0]) and (Copy(sLine, length(sLine), 1) = Brackets[1]) then begin
         // regular section
         // regular section
@@ -670,10 +671,10 @@ var
 begin
 begin
   oSection := FSectionList.SectionByName(Section);
   oSection := FSectionList.SectionByName(Section);
   if oSection <> nil then begin
   if oSection <> nil then begin
-    oSection.Free;
     { It is needed so UpdateFile doesn't find a defunct section }
     { It is needed so UpdateFile doesn't find a defunct section }
     { and cause the program to crash }
     { and cause the program to crash }
     FSectionList.Delete(FSectionList.IndexOf(oSection));
     FSectionList.Delete(FSectionList.IndexOf(oSection));
+    oSection.Free;
     UpdateFile;
     UpdateFile;
   end;
   end;
 end;
 end;
@@ -790,7 +791,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.8  2005-02-14 17:13:15  peter
+  Revision 1.9  2005-04-05 21:08:08  peter
+    * fix memory leaks
+
+  Revision 1.8  2005/02/14 17:13:15  peter
     * truncate log
     * truncate log
 
 
 }
 }