mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
don't ignore malloc failure in cJSON_PrintBuffered
This commit is contained in:
parent
a1c022fef6
commit
5323f558cd
4
cJSON.c
4
cJSON.c
@ -845,6 +845,10 @@ char *cJSON_PrintBuffered(const cJSON *item, int prebuffer, int fmt)
|
|||||||
{
|
{
|
||||||
printbuffer p;
|
printbuffer p;
|
||||||
p.buffer = (char*)cJSON_malloc(prebuffer);
|
p.buffer = (char*)cJSON_malloc(prebuffer);
|
||||||
|
if (!p.buffer)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
p.length = prebuffer;
|
p.length = prebuffer;
|
||||||
p.offset = 0;
|
p.offset = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user