summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2010-01-27 18:01:17 -0200
committerBlue Swirl <blauwirbel@gmail.com>2010-01-28 19:09:44 +0000
commit82617d7ce3bdeef6fa32f71f9976b2f4bf3589e9 (patch)
treec8d83faa89ab0916c9942d0dd6b67fc98b4c7b5b /monitor.c
parent8f4efc55887957f7ca7d87d4a6b58463cfc9d0d6 (diff)
downloadqemu-82617d7ce3bdeef6fa32f71f9976b2f4bf3589e9.tar.gz
qemu-82617d7ce3bdeef6fa32f71f9976b2f4bf3589e9.tar.bz2
qemu-82617d7ce3bdeef6fa32f71f9976b2f4bf3589e9.zip
Monitor: Fix command execution regression
Function is_async_return() added by commit 940cc30d0d4 assumes that 'data', which is returned by handlers, is always a QDict. This is not true, as QLists can also be returned, in this case we'll get a segfault. Fix that by checking if 'data' is a QDict. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/monitor.c b/monitor.c
index fbae5ce09f..fb7c57231a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3700,7 +3700,11 @@ static void monitor_print_error(Monitor *mon)
static int is_async_return(const QObject *data)
{
- return data && qdict_haskey(qobject_to_qdict(data), "__mon_async");
+ if (data && qobject_type(data) == QTYPE_QDICT) {
+ return qdict_haskey(qobject_to_qdict(data), "__mon_async");
+ }
+
+ return 0;
}
static void monitor_call_handler(Monitor *mon, const mon_cmd_t *cmd,