Browse Source

* Fix bug #36052, defaultencoding does not need to be freed

git-svn-id: trunk@42932 -
michael 6 years ago
parent
commit
0bbe319d4c
1 changed files with 2 additions and 9 deletions
  1. 2 9
      packages/fcl-base/src/inifiles.pp

+ 2 - 9
packages/fcl-base/src/inifiles.pp

@@ -1381,17 +1381,10 @@ begin
       if FEncoding=nil then
         slLines.LoadFromFile(FFileName)
       else
-      begin
-        slLines.DefaultEncoding := FEncoding;
-        slLines.LoadFromFile(FFileName, nil);
-        if FEncoding <> slLines.Encoding then
         begin
-          if FOwnsEncoding then
-            FEncoding.Free;
-          FEncoding := slLines.Encoding;
-          FOwnsEncoding := not TEncoding.IsStandardEncoding(FEncoding);
+        slLines.DefaultEncoding := FEncoding; // TStrings clones the encoding.
+        slLines.LoadFromFile(FFileName, nil);
         end;
-      end;
       FillSectionList(slLines);
     finally
       slLines.Free;