diff options
author | Eric Hawicz <erh+git@nimenees.com> | 2020-08-24 09:51:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-24 09:51:41 -0400 |
commit | 785a94b7a25890f9c44902631d67512631c3519f (patch) | |
tree | cd1475f45f9a1d0ff6fd33ec130a05118861b814 | |
parent | eb08a92218a510549a56b2cec1e79e670ed1cddc (diff) | |
parent | bcb6d7d3474b687718cbaee7bf203db4456fb6b3 (diff) | |
download | json-c-785a94b7a25890f9c44902631d67512631c3519f.tar.gz |
Merge pull request #665 from stoeckmann/tokener
Handle more allocation failures in json_tokener* functions
-rw-r--r-- | json_tokener.c | 6 |
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; |