Browse Source

* Patch from Luca Olivetti to fix memleak in CORS support. Fixes issue #39886

Michaël Van Canneyt 2 years ago
parent
commit
bc100eda4d
1 changed files with 7 additions and 0 deletions
  1. 7 0
      packages/fcl-web/src/base/fphttp.pp

+ 7 - 0
packages/fcl-web/src/base/fphttp.pp

@@ -119,6 +119,7 @@ Type
     Property CORS : TCORSSupport Read FCORS Write SetCORS;
   public
     Constructor CreateNew(aOwner : TComponent; CreateMode: Integer); overload; override;
+    destructor Destroy;override;
     Class Procedure RegisterModule(Const AModuleName : String = ''); overload;
     Class Procedure RegisterModule(Const AModuleName : String; ASkipStreaming : Boolean); overload;
     Procedure HandleRequest(ARequest : TRequest; AResponse : TResponse); virtual; abstract;
@@ -322,6 +323,12 @@ begin
   FCORS:=CreateCORSSupport;
 end;
 
+destructor TCustomHTTPModule.Destroy;
+begin
+  FCORS.Free;
+  inherited Destroy;
+end;
+
 Class Procedure TCustomHTTPModule.RegisterModule(Const AModuleName: String);
 begin
   RegisterModule(AModuleName,DefaultSkipStreaming);