summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2010-01-11 17:30:50 +0000
committerAnthony Liguori <aliguori@us.ibm.com>2010-01-12 13:34:48 -0600
commitbe59ce1f48720b385c124f7567aedd5829f96540 (patch)
tree53f77f833ea584a021ef34e6cda2bdd5e6decf79
parentQMP: Don't free async event's 'data' (diff)
downloadqemu-kvm-be59ce1f48720b385c124f7567aedd5829f96540.tar.gz
qemu-kvm-be59ce1f48720b385c124f7567aedd5829f96540.tar.bz2
qemu-kvm-be59ce1f48720b385c124f7567aedd5829f96540.zip
vnc_refresh: return if vd->timer is NULL
Hi all, calling vnc_update_client in vnc_refresh might have the unlikely side effect of setting vd->timer = NULL, if the last vnc client disconnected. In this case we have to return from vnc_refresh without updating the timer, otherwise we cause a segfault. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit 83755c173f4608764e3ee92428247d1c5e962e6a)
-rw-r--r--vnc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/vnc.c b/vnc.c
index c54c6e070..58eac73f9 100644
--- a/vnc.c
+++ b/vnc.c
@@ -2305,6 +2305,10 @@ static void vnc_refresh(void *opaque)
rects += vnc_update_client(vs, has_dirty);
vs = vs->next;
}
+ /* vd->timer could be NULL now if the last client disconnected,
+ * in this case don't update the timer */
+ if (vd->timer == NULL)
+ return;
if (has_dirty && rects) {
vd->timer_interval /= 2;