When you are done with the tree of objects, you call json_object_put() on just the root object to free it, which recurses down through any child objects calling json_object_put() on each one of those in turn.
This change marks the JSON object we parsed to be freed and resolves the memory leak.
For context, see the conversation in https://github.com/bzier/gym-mupen64plus/issues/80 regarding the memory leak, investigation and resolution.
According to the docs for the
json-c
library,This change marks the JSON object we parsed to be freed and resolves the memory leak.