summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Hawicz <erh+git@nimenees.com>2020-08-24 09:51:41 -0400
committerGitHub <noreply@github.com>2020-08-24 09:51:41 -0400
commit785a94b7a25890f9c44902631d67512631c3519f (patch)
treecd1475f45f9a1d0ff6fd33ec130a05118861b814
parenteb08a92218a510549a56b2cec1e79e670ed1cddc (diff)
parentbcb6d7d3474b687718cbaee7bf203db4456fb6b3 (diff)
downloadjson-c-785a94b7a25890f9c44902631d67512631c3519f.tar.gz
Merge pull request #665 from stoeckmann/tokener
Handle more allocation failures in json_tokener* functions
-rw-r--r--json_tokener.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/json_tokener.c b/json_tokener.c
index 6527270..aad463a 100644
--- a/json_tokener.c
+++ b/json_tokener.c
@@ -134,6 +134,12 @@ struct json_tokener *json_tokener_new_ex(int depth)
return NULL;
}
tok->pb = printbuf_new();
+ if (!tok->pb)
+ {
+ free(tok);
+ free(tok->stack);
+ return NULL;
+ }
tok->max_depth = depth;
json_tokener_reset(tok);
return tok;