summaryrefslogtreecommitdiffstats
path: root/qobject
diff options
context:
space:
mode:
authorMarkus Armbruster2018-08-23 18:40:03 +0200
committerMarkus Armbruster2018-08-24 20:26:37 +0200
commit269e57ae28599b07368134a64452674009491593 (patch)
tree3175d970b20b3013db593dbbe2888d294271963a /qobject
parentjson: Don't pass null @tokens to json_parser_parse() (diff)
downloadqemu-269e57ae28599b07368134a64452674009491593.tar.gz
qemu-269e57ae28599b07368134a64452674009491593.tar.xz
qemu-269e57ae28599b07368134a64452674009491593.zip
json: Don't create JSON_ERROR tokens that won't be used
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180823164025.12553-37-armbru@redhat.com>
Diffstat (limited to 'qobject')
-rw-r--r--qobject/json-streamer.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/qobject/json-streamer.c b/qobject/json-streamer.c
index 0c33186e8e..fa595a8761 100644
--- a/qobject/json-streamer.c
+++ b/qobject/json-streamer.c
@@ -56,6 +56,8 @@ void json_message_process_token(JSONLexer *lexer, GString *input,
case JSON_RSQUARE:
parser->bracket_count--;
break;
+ case JSON_ERROR:
+ goto out_emit;
default:
break;
}
@@ -71,10 +73,6 @@ void json_message_process_token(JSONLexer *lexer, GString *input,
g_queue_push_tail(parser->tokens, token);
- if (type == JSON_ERROR) {
- goto out_emit;
- }
-
if (parser->brace_count < 0 ||
parser->bracket_count < 0 ||
(parser->brace_count == 0 &&