aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-02-11 21:00:38 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-02-11 21:00:38 +0000
commit452b4d88e59d59dc6acd02d861f073ed430c79cf (patch)
treee253009112739d760bdcd9b7b1b6846014bee9ad
parent322691a5c9f1c8531554148d47c078b5be590805 (diff)
monitor: Don't change VNC server when disabled (Jan Kiszka)
[ As requested, broken out of the monitor rework series. ] Avoid a segfault when the user issues 'change vnc' without having vnc enabled on startup. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6616 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--vnc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/vnc.c b/vnc.c
index 68df599615..bdfc79b84d 100644
--- a/vnc.c
+++ b/vnc.c
@@ -2333,6 +2333,8 @@ void vnc_display_close(DisplayState *ds)
{
VncState *vs = ds ? (VncState *)ds->opaque : vnc_state;
+ if (!vs)
+ return;
if (vs->display) {
qemu_free(vs->display);
vs->display = NULL;
@@ -2392,6 +2394,8 @@ int vnc_display_open(DisplayState *ds, const char *display)
int tls = 0, x509 = 0;
#endif
+ if (!vnc_state)
+ return -1;
vnc_display_close(ds);
if (strcmp(display, "none") == 0)
return 0;