Browse Source

* Fix memleak

Michaël Van Canneyt 1 year ago
parent
commit
dcadafa1b8
1 changed files with 2 additions and 2 deletions
  1. 2 2
      packages/fcl-web/examples/fcm/cli/sendmsg.pp

+ 2 - 2
packages/fcl-web/examples/fcm/cli/sendmsg.pp

@@ -64,6 +64,7 @@ Var
   Obj : TJSONObject absolute D;
   Obj : TJSONObject absolute D;
 
 
 begin
 begin
+  D:=Nil;
   F:=TFileStream.Create(aFileName,fmOpenRead or fmShareDenyWrite);
   F:=TFileStream.Create(aFileName,fmOpenRead or fmShareDenyWrite);
   try
   try
     D:=GetJSON(F);
     D:=GetJSON(F);
@@ -73,6 +74,7 @@ begin
     Msg.Body:=Obj.Get('body',Msg.Body);
     Msg.Body:=Obj.Get('body',Msg.Body);
     Msg.Image:=Obj.Get('image',Msg.Image);
     Msg.Image:=Obj.Get('image',Msg.Image);
   finally
   finally
+    D.Free;
     F.Free;
     F.Free;
   end;
   end;
 end;
 end;
@@ -80,7 +82,6 @@ end;
 
 
 procedure TFCMApplication.ConfigureMessage(Msg : TNotificationMessage);
 procedure TFCMApplication.ConfigureMessage(Msg : TNotificationMessage);
 
 
-
 begin
 begin
   if HasOption('m','message') then
   if HasOption('m','message') then
     LoadMessageFromFile(Msg,GetOptionValue('m','message'));
     LoadMessageFromFile(Msg,GetOptionValue('m','message'));
@@ -90,7 +91,6 @@ begin
     Msg.Body:=GetoptionValue('b','body');
     Msg.Body:=GetoptionValue('b','body');
   if HasOption('i','image') then
   if HasOption('i','image') then
     Msg.Body:=GetoptionValue('i','image');
     Msg.Body:=GetoptionValue('i','image');
-
 end;
 end;
 
 
 procedure TFCMApplication.DoHandleNewToken(Sender: TObject; const aToken: TBearerToken);
 procedure TFCMApplication.DoHandleNewToken(Sender: TObject; const aToken: TBearerToken);