Browse Source

Fix memleak (bug ID 0035761)

git-svn-id: trunk@42282 -
michael 6 years ago
parent
commit
7137289d41
1 changed files with 8 additions and 0 deletions
  1. 8 0
      packages/fcl-registry/src/registry.pp

+ 8 - 0
packages/fcl-registry/src/registry.pp

@@ -243,6 +243,7 @@ type
   public
   public
     constructor Create(const AFileName: string); overload;
     constructor Create(const AFileName: string); overload;
     constructor Create(const AFileName: string; AAccess: LongWord); overload;
     constructor Create(const AFileName: string; AAccess: LongWord); overload;
+    destructor destroy; override;
     function ReadDate(const Section, Name: string; Default: TDateTime): TDateTime; override;
     function ReadDate(const Section, Name: string; Default: TDateTime): TDateTime; override;
     function ReadDateTime(const Section, Name: string; Default: TDateTime): TDateTime; override;
     function ReadDateTime(const Section, Name: string; Default: TDateTime): TDateTime; override;
     function ReadInteger(const Section, Name: string; Default: Longint): Longint; override;
     function ReadInteger(const Section, Name: string; Default: Longint): Longint; override;
@@ -990,6 +991,13 @@ begin
   Create(AFileName,KEY_ALL_ACCESS);
   Create(AFileName,KEY_ALL_ACCESS);
 end;
 end;
 
 
+destructor TRegistryIniFile.destroy;
+
+begin
+  FreeAndNil(FRegInifile);
+  Inherited;
+end;
+
 procedure TRegistryIniFile.DeleteKey(const Section, Name: String);
 procedure TRegistryIniFile.DeleteKey(const Section, Name: String);
 begin
 begin
   FRegIniFile.Deletekey(section,name);
   FRegIniFile.Deletekey(section,name);