]> git.proxmox.com Git - mirror_qemu.git/commitdiff
vnc_refresh: return if vd->timer is NULL
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Mon, 11 Jan 2010 17:30:50 +0000 (17:30 +0000)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 12 Jan 2010 19:24:52 +0000 (13:24 -0600)
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>
vnc.c

diff --git a/vnc.c b/vnc.c
index c54c6e070cc82093bc5f8a55fbfaba086f73a511..58eac73f940595e528fc9ae518e0674eccae8044 100644 (file)
--- 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;