diff mbox

[1/2] vnc: fix segfault due to failed handshake

Message ID 1349796101-6660-2-git-send-email-thardeck@suse.de
State New
Headers show

Commit Message

Tim Hardeck Oct. 9, 2012, 3:21 p.m. UTC
When the VNC server disconnects due to a failed handshake we don't have
vs->bh allocated yet.

Check for this case and don't delete it.

Signed-off-by: Tim Hardeck <thardeck@suse.de>
---
 ui/vnc.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/ui/vnc.c b/ui/vnc.c
index 01b2daf..656895a 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1055,7 +1055,9 @@  static void vnc_disconnect_finish(VncState *vs)
     vnc_unlock_output(vs);
 
     qemu_mutex_destroy(&vs->output_mutex);
-    qemu_bh_delete(vs->bh);
+    if (vs->bh != NULL) {
+        qemu_bh_delete(vs->bh);
+    }
     buffer_free(&vs->jobs_buffer);
 
     for (i = 0; i < VNC_STAT_ROWS; ++i) {