summaryrefslogtreecommitdiffstats
path: root/qapi
diff options
context:
space:
mode:
authorMarkus Armbruster2017-02-17 21:38:18 +0100
committerMarkus Armbruster2017-02-22 19:52:01 +0100
commitca6b6e1e68ac44b2e8895da10dd1c80dc03d08b7 (patch)
tree3e820280a3eb45a68186eaec2f46fba2b1fe63b8 /qapi
parenttest-qmp-event: Simplify and tighten event_test_emit() (diff)
downloadqemu-ca6b6e1e68ac44b2e8895da10dd1c80dc03d08b7.tar.gz
qemu-ca6b6e1e68ac44b2e8895da10dd1c80dc03d08b7.tar.xz
qemu-ca6b6e1e68ac44b2e8895da10dd1c80dc03d08b7.zip
Don't check qobject_type() before qobject_to_qdict()
qobject_to_qdict(obj) returns NULL when obj isn't a QDict. Check that instead of qobject_type(obj) == QTYPE_QDICT. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1487363905-9480-8-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'qapi')
-rw-r--r--qapi/qmp-dispatch.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index 505eb418ac..48bec2072b 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -28,14 +28,13 @@ static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp)
bool has_exec_key = false;
QDict *dict = NULL;
- if (qobject_type(request) != QTYPE_QDICT) {
+ dict = qobject_to_qdict(request);
+ if (!dict) {
error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT,
"request is not a dictionary");
return NULL;
}
- dict = qobject_to_qdict(request);
-
for (ent = qdict_first(dict); ent;
ent = qdict_next(dict, ent)) {
arg_name = qdict_entry_key(ent);