Skip to content

Commit 4e0b719

Browse files
Memory leaks
1 parent e662f25 commit 4e0b719

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Horse.JWT.pas

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ THorseJWTCallback = class
3333
FHeader: string;
3434
public
3535
constructor Create;
36+
destructor Destroy; override;
3637
class function New: THorseJWTCallback;
3738
property Config: THorseJWTConfig read FConfig;
3839
function SetConfig(AConfig: THorseJWTConfig): THorseJWTCallback;
@@ -103,7 +104,7 @@ function HorseJWT(ASecretJWT: string; ASessionClass: TClass; AConfig: THorseJWTC
103104

104105
procedure THorseJWTCallback.Callback(AHorseRequest: THorseRequest; AHorseResponse: THorseResponse; ANext: TProc);
105106
var
106-
LBuilder : IJOSEConsumerBuilder;
107+
LBuilder: IJOSEConsumerBuilder;
107108
LValidations: TJOSEConsumer;
108109
LJWT: TJOSEContext;
109110
LToken, LHeaderNormalize: string;
@@ -191,7 +192,14 @@ procedure THorseJWTCallback.Callback(AHorseRequest: THorseRequest; AHorseRespons
191192

192193
constructor THorseJWTCallback.Create;
193194
begin
194-
FConfig := THorseJWTConfig.Create;
195+
FConfig := THorseJWTConfig.Create;
196+
end;
197+
198+
destructor THorseJWTCallback.Destroy;
199+
begin
200+
if Assigned(FConfig) then
201+
FConfig.Free;
202+
inherited;
195203
end;
196204

197205
class function THorseJWTCallback.New: THorseJWTCallback;

0 commit comments

Comments
 (0)