Merge pull request #377 from coreyfarrell/extra-refs

Remove extra reference actions in parsers.
This commit is contained in:
Petri Lehtinen 2017-12-13 07:07:33 +02:00 committed by GitHub
commit bc5c6826ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -738,13 +738,11 @@ static json_t *parse_object(lex_t *lex, size_t flags, json_error_t *error)
goto error;
}
if(json_object_set_nocheck(object, key, value)) {
if(json_object_set_new_nocheck(object, key, value)) {
jsonp_free(key);
json_decref(value);
goto error;
}
json_decref(value);
jsonp_free(key);
lex_scan(lex, error);
@ -781,11 +779,9 @@ static json_t *parse_array(lex_t *lex, size_t flags, json_error_t *error)
if(!elem)
goto error;
if(json_array_append(array, elem)) {
json_decref(elem);
if(json_array_append_new(array, elem)) {
goto error;
}
json_decref(elem);
lex_scan(lex, error);
if(lex->token != ',')