Open anudeep010291 opened 3 years ago
Can you share a stack trace of core?
If you use json_object_get()
before json_object_clear()
, then use the thing you got out of the object after the clear, that is invalid and would cause a segfault. If you will keep a reference to the thing after clearing the object, you should use json_incref()
on it.
Hi, I have an embedded device in which I have trying to read a data from a file and convert it into JSON object using json_loads.
file_str="Read data from a file"
;json_t* file_read = json_loads(file_str, 0, NULL);
json_object_clear(file_read);
I am clearing the json object but still the process gets killed automatically after a while with an error saying "segmentation error(core dumped)".Can someone tell what the issue is here. ?