Browse Source

* Fix mem leak

Michaël Van Canneyt 1 month ago
parent
commit
433d93c105
1 changed files with 4 additions and 2 deletions
  1. 4 2
      packages/vcl-compat/src/system.json.pp

+ 4 - 2
packages/vcl-compat/src/system.json.pp

@@ -1872,8 +1872,10 @@ end;
 
 
 destructor TJSONPair.Destroy;
 destructor TJSONPair.Destroy;
 begin
 begin
-  JSonString:=nil;
-  JsonValue:=nil;
+  if Assigned(FJSonString) and (FJSONString.Owned) then
+    FreeAndNil(FJSonString);
+  if Assigned(FJSonValue) and (FJSONValue.Owned) then
+    FreeAndNil(FJSonValue);
   inherited Destroy;
   inherited Destroy;
 end;
 end;