cJSON_Print注意问题

cjson导致内存泄漏


原因:

char* text = cJSON_Print(jout);fprintf(this->outstream, "%s", text);free(text); // As suggested by PaulPonomarev.cJSON_Delete(jout);

cJSON_Print会申请内存,text要free掉

你可能感兴趣的:(常见错误)