code
cJSON *body = cJSON_Duplicate(record, true);
cJSON_AddItemToObject(body, KEY_LOG, log);
cJSON *array_pl = cJSON_CreateArray();
cJSON_AddItemToArray(array_pl, body);
cJSON *payload = cJSON_CreateObject();
cJSON_AddItemToObject(payload, KEY_PAYLOAD, array_pl);
cJSON_Delete(body);
cJSON_Delete(array_pl);
cJSON_Delete(payload);
Whenever I use cJSON_Delete() program gets crashed and gives error *** Error in `./sample': free(): invalid pointer: 0xb5db1e18 ***
I searched a lot about this but couldn't found a solution.
Please tell me how this works ?