aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/monitor.c b/monitor.c
index ead4c633fb..5aff7aebb0 100644
--- a/monitor.c
+++ b/monitor.c
@@ -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;
}