1
0
mirror of https://github.com/DaveGamble/cJSON synced 2024-12-25 16:12:04 +00:00

Handle out of memory when printing string

This commit is contained in:
Max Bruckner 2016-11-28 23:06:22 +07:00
parent 8df4cd46eb
commit 6622c54f18

View File

@ -1452,7 +1452,10 @@ static char *print_object(const cJSON *item, int depth, cjbool fmt, printbuffer
}
/* print key */
print_string_ptr(child->string, p);
if (!print_string_ptr(child->string, p))
{
return NULL;
}
p->offset = update(p);
len = fmt ? 2 : 1;