Commit 452b4d88e59d59dc6acd02d861f073ed430c79cf

Authored by aliguori
1 parent 322691a5

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
Showing 1 changed file with 4 additions and 0 deletions
... ... @@ -2333,6 +2333,8 @@ void vnc_display_close(DisplayState *ds)
2333 2333 {
2334 2334 VncState *vs = ds ? (VncState *)ds->opaque : vnc_state;
2335 2335  
  2336 + if (!vs)
  2337 + return;
2336 2338 if (vs->display) {
2337 2339 qemu_free(vs->display);
2338 2340 vs->display = NULL;
... ... @@ -2392,6 +2394,8 @@ int vnc_display_open(DisplayState *ds, const char *display)
2392 2394 int tls = 0, x509 = 0;
2393 2395 #endif
2394 2396  
  2397 + if (!vnc_state)
  2398 + return -1;
2395 2399 vnc_display_close(ds);
2396 2400 if (strcmp(display, "none") == 0)
2397 2401 return 0;
... ...