diff options
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -3712,12 +3712,12 @@ static QDict *qmp_check_input_obj(QObject *input_obj, Error **errp) int has_exec_key = 0; QDict *input_dict; - if (qobject_type(input_obj) != QTYPE_QDICT) { + input_dict = qobject_to_qdict(input_obj); + if (!input_dict) { error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT, "object"); return NULL; } - input_dict = qobject_to_qdict(input_obj); for (ent = qdict_first(input_dict); ent; ent = qdict_next(input_dict, ent)){ const char *arg_name = qdict_entry_key(ent); @@ -3761,10 +3761,11 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens) Error *err = NULL; req = json_parser_parse_err(tokens, NULL, &err); - if (err || !req || qobject_type(req) != QTYPE_QDICT) { - if (!err) { - error_setg(&err, QERR_JSON_PARSING); - } + if (!req && !err) { + /* json_parser_parse_err() sucks: can fail without setting @err */ + error_setg(&err, QERR_JSON_PARSING); + } + if (err) { goto err_out; } |