Memory leak in uJSONToRODL.TJSONToRODL.LoadStreamToLibrary


I am observing a memory leak inside uJSONToRODL.TJSONToRODL.LoadStreamToLibrary as being called indirectly by TROServer.RebuildServices.
The code has this line:

l_root := JSON_ParseStream(Source, True).AsObject;

Where JSON_ParseStream creates an instance and by contract expects the caller to take ownership of the instance it has created.
Sadly, the LoadStreamToLibrary method never frees it and thus an entire JSON structure is leaked.
Note that freeing l_root is not enough because it’s the return of AsObject that would be freed and not the result of JSON_ParseStream.

Here is a patch file with the change that I have done: (628 Bytes)

With this, I no longer get a memory leak while not getting any errors at runtime.

Hope this helps.


should be already fixed in .1577

Ah, fair enoug, we are still on as it was the only one generally available when we started our upgrade