don't ignore malloc failure in cJSON_PrintBuffered

This commit is contained in:
Rod Vagg 2016-10-31 10:54:34 +11:00
parent a1c022fef6
commit 5323f558cd

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;