中级会员
 
- 积分
- 489
- 金钱
- 489
- 注册时间
- 2015-2-5
- 在线时间
- 113 小时
|
1金钱
在使用CJSON库的时候调用cJSON_Parse(jsondata); 时候程序会死机 堆栈:Heap_Size EQU 0x1000 也是用了内存管理 借用原子哥的malloc程序 希望用过的朋友 帮忙指引一下。
void CParsejson(void *data)
{
u8 i=0,*jsonstrx;
u8 jsondata[250];
u8 status;
cJSON * root, *itemName,*itemAge,*order;
jsonstrx=strstr((const char*)data,(const char*)"{");
if(jsonstrx)
{
while(1)
{
if(jsonstrx[i]==0x0D)
{
jsondata[i-1]=0;
i=0;
break;
}
jsondata[i]=jsonstrx[i];
i++;
}
}
root = cJSON_Parse(jsondata);
order = cJSON_GetObjectItem(root, "status");
if (order)
{
status=order->valueint;
LREALY(1);
}
memset(jsondata, 0, 250);
cJSON_Delete(root);
}
|
|