封装在 proftpd 中的以下 JSON 函数在 free 函数中崩溃。
有人能告诉我我哪里用错了吗?
pool *tmp pool object;
tmp pool object = make sub pool(permanent pool),
pr_pool tag(tmp pool object,"json object pool"),
pr json object t *json object main;
json object main = pr json object alloc(tmp pool object);
pr_json object_set_number(tmp_pool object,json object main,"task type",1),
pr json object set number(tmp pool object,json object main,"task id",security check task id),
pr json object set string(tmp pool object,json object main,"task name","test");
pr json array t *json array templatecode;
json array templatecode = pr json array alloc(tmp pool object);
pr_json array append number(tmp pool object,json array templatecode,security check template id),
pr json object set array(tmp pool object, json object main, "template code",json array templatecode);
pr json object t *json object filelist;
json object filelist = pr json object alloc(tmp pool object),
pr json array t *json array filelist;
json array filelist = pr json array alloc(tmp pool object);
pr json object set number(tmp pool object,json object filelist,"file dir",2);
pr json object set string(tmp pool object,json object filelist,"file name",filename),
pr json object set string(tmp pool object,json object filelist,"file path",absolute path);
pr json array append object(tmp pool object,json array filelist,json object filelist),
pr json object set array(tmp pool object, json object main, "file list",json array filelist),
char *payload = NULL;
size t payload len = 0:
payload = pr json object to text(tmp pool object, json object main,"");
payload len =strlen(payload);
pr json array free(json array filelist):
pr json object free(json object filelist);
pr json array free(json array templatecode),
pr json object free(json object main);
destroy pool(tmp pool object);