mirror of
https://github.com/DaveGamble/cJSON.git
synced 2026-11-06 15:51:31 +00:00
don't ignore malloc failure in cJSON_PrintBuffered
This commit is contained in:
1 parent
a1c022fef6
commit
5323f558cd
1 file changed
+4
@@ -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;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user