esp32 crashes when cJSON_Delete is called
Posted: Wed Jun 17, 2020 6:44 am
I Hope every one is doing fine. I am using esp32 for a project and it keeps on crashing as soon as cJSON_Delete() is called
my code
crash happens every time after the printf to print data1 and data2
this is printed when esp32 crashes
CORRUPT HEAP: multi_heap.c:477 detected at 0x3ffcd910
abort() was called at PC 0x40091cd9 on core 0
ELF file SHA256: 36986c6c1341bb59
Backtrace: 0x4008f839:0x3ffcb3a0 0x4008fbbd:0x3ffcb3c0 0x40091cd9:0x3ffcb3e0 0x400823b6:0x3ffcb400 0x400950d5:0x3ffcb420 0x400fe4ce:0x3ffcb440 0x400fe4bd:0x3ffcb460 0x400d7184:0x3ffcb480 0x4009216d:0x3ffcb4b0
Rebooting...
Please point me in the correct direction to resolve this issue.
Thanks in advance.
my code
Code: Select all
printf("%s\r\n,buffer);
cJSON *root = cJSON_Parse(buffer);
char *data1 = cJSON_GetObjectItem(root, "data1")->valuestring;
char *data2 = cJSON_GetObjectItem(root, "data2")->valuestring;
printf("data1: %s | data2:%s\r\n",data1,data2);
cJSON_Delete(root);
this is printed when esp32 crashes
CORRUPT HEAP: multi_heap.c:477 detected at 0x3ffcd910
abort() was called at PC 0x40091cd9 on core 0
ELF file SHA256: 36986c6c1341bb59
Backtrace: 0x4008f839:0x3ffcb3a0 0x4008fbbd:0x3ffcb3c0 0x40091cd9:0x3ffcb3e0 0x400823b6:0x3ffcb400 0x400950d5:0x3ffcb420 0x400fe4ce:0x3ffcb440 0x400fe4bd:0x3ffcb460 0x400d7184:0x3ffcb480 0x4009216d:0x3ffcb4b0
Rebooting...
Please point me in the correct direction to resolve this issue.
Thanks in advance.