Hello,

In TCustomSQLQuery.Create, FRefreshSQL:TStringList is created on line 2095,
but never freed. This causes a small memory leak.

Please see the attached test program demonstrating the issue.

Reported on the bugtracker here:
http://bugs.freepascal.org/view.php?id=27220

Please review the attached patch, and apply if suitable.

Thanks.

---

program project1;

uses
  heaptrc, SQLdb, DB;

var
  FQuery : TSQLQuery;

begin
  FQuery := TSQLQuery.create(nil);
  FQuery.Free;

end.

---

Index: sqldb.pp
===================================================================
--- sqldb.pp (revision 29360)
+++ sqldb.pp (working copy)
@@ -2118,6 +2118,7 @@
   FreeAndNil(FInsertSQL);
   FreeAndNil(FDeleteSQL);
   FreeAndNil(FUpdateSQL);
+  FreeAndNil(FRefreshSQL);
   FServerIndexDefs.Free;
   inherited Destroy;
 end;

---
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to