cJSON

mirror of Dave's cJSON
git clone git://git.thc420.xyz/cJSON
Log | Files | Refs | README | LICENSE

commit b355733aa1b55718ec488f212e5919f6491a23cd
parent a1c022fef69f46e71d180b59cb261c9feba0ab22
Author: Max Bruckner <max@maxbruckner.de>
Date:   Mon, 31 Oct 2016 08:19:08 +0700

Merge pull request #43 from rvagg/malloc-err

don't ignore malloc failure in cJSON_PrintBuffered
Diffstat:
McJSON.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/cJSON.c b/cJSON.c @@ -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;