fix use after free
authorGlauber Costa <glommer@redhat.com>
Fri, 25 Sep 2009 12:30:57 +0000 (08:30 -0400)
committerAurelien Jarno <aurelien@aurel32.net>
Fri, 25 Sep 2009 16:26:59 +0000 (18:26 +0200)
We are using the vs structure when it was just freed. Classic use after free,
fix it.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
vnc.c

diff --git a/vnc.c b/vnc.c
index 5eaef6a..592c9b3 100644 (file)
--- a/vnc.c
+++ b/vnc.c
@@ -918,8 +918,8 @@ static void vnc_disconnect_finish(VncState *vs)
     if (!vs->vd->clients)
         dcl->idle = 1;
 
-    qemu_free(vs);
     vnc_remove_timer(vs->vd);
+    qemu_free(vs);
 }
 
 int vnc_client_io_error(VncState *vs, int ret, int last_errno)