I am using the Jansson library in my c++ code. In the library when any Jansson variable is created, the variable should be freed to release the reference and I am using the 'json_decref(json_t *json)' method to release. But sometimes it causes the double free problem and I didn't get the problem in runtime. Maybe it is not normal but I want to get a runtime error when I try to release some references. For example, I am running the following test code,
json_t *root = json_loads(any_json_message, 0, &error);
json_decref(root);
json_decref(root);
As you see there is a problem and I don't get any runtime error like double free.
Also, I am using CMake to compile my source code. Maybe any cmake flag fixes my question.
Any idea ?