I have the following code
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <json/json.h>
int main(int argc, char **argv)
{
json_object *new_obj;
char buf[] = "{ \"foo\": \"bar\", \"foo2\": \"bar2\", \"foo3\": \"bar3\" }";
new_obj = json_tokener_parse(buf);
.....
json_object_put(new_obj);
}
Does the json_object_put(new_obj)
free all memory related to new_obj
?
From the documentation:
void json_object_put (struct json_object *this)
Decrement the reference count of json_object and free if it reaches zero
Source: http://oss.metaparadigm.com/json-c/doc/html/json__object_8h.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With