Skip to contentSkip to conversation

monitor: Don't change VNC server when disabled

PATCH Applied Jan Kiszka 2 participants 2 messages Feb 10, 2009 – Feb 11, 2009

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 monitor: Don't change VNC server when disabled

[ As requested, broken out of the monitor rework series. ]

Avoid a segfault when the user issues 'change vnc' without having vnc enabled on startup.

---

 vnc.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
vnc.c +4 -0
index 68df599..bdfc79b 100644
@@ -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;
#1 lore raw
Quoted 7 lines · 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.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 30 lines

---

 vnc.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
vnc.c +4 -0
index 68df599..bdfc79b 100644
@@ -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;