json_tokener_parse(): avoid possible NULL deref

This commit is contained in:
Frederik Deweerdt
2012-01-18 17:01:19 -08:00
parent 393085a4ba
commit db050901fa

View File

@@ -113,6 +113,8 @@ struct json_object* json_tokener_parse(const char *str)
struct json_object* obj;
tok = json_tokener_new();
if (!tok)
return NULL;
obj = json_tokener_parse_ex(tok, str, -1);
if(tok->err != json_tokener_success)
obj = NULL;