Merge pull request #43 from rvagg/malloc-err

don't ignore malloc failure in cJSON_PrintBuffered
This commit is contained in:
Max Bruckner 2016-10-31 08:19:08 +07:00 committed by GitHub
commit b355733aa1

View File

@ -845,6 +845,10 @@ char *cJSON_PrintBuffered(const cJSON *item, int prebuffer, int fmt)
{
printbuffer p;
p.buffer = (char*)cJSON_malloc(prebuffer);
if (!p.buffer)
{
return 0;
}
p.length = prebuffer;
p.offset = 0;