From: Gonglei <arei.gong...@huawei.com> vnc_display_close() is called in vnc_display_open(). And in this moment, the ds variable is initilized at vnc_display_init(). Calling vnc_display_close() is superfluous.
For another scenario, qmp_change_vnc_listen() pass NULL into vnc_display_open(), which is not influenced too. Let's remove it. Signed-off-by: Gonglei <arei.gong...@huawei.com> --- ui/vnc.c | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 0fe6eff..628a7ba 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2972,36 +2972,6 @@ void vnc_display_init(DisplayState *ds) register_displaychangelistener(&vs->dcl); } - -static void vnc_display_close(DisplayState *ds) -{ - VncDisplay *vs = vnc_display; - - if (!vs) - return; - g_free(vs->display); - vs->display = NULL; - if (vs->lsock != -1) { - qemu_set_fd_handler2(vs->lsock, NULL, NULL, NULL, NULL); - close(vs->lsock); - vs->lsock = -1; - } -#ifdef CONFIG_VNC_WS - g_free(vs->ws_display); - vs->ws_display = NULL; - if (vs->lwebsock != -1) { - qemu_set_fd_handler2(vs->lwebsock, NULL, NULL, NULL, NULL); - close(vs->lwebsock); - vs->lwebsock = -1; - } -#endif /* CONFIG_VNC_WS */ - vs->auth = VNC_AUTH_INVALID; -#ifdef CONFIG_VNC_TLS - vs->subauth = VNC_AUTH_INVALID; - vs->tls.x509verify = 0; -#endif -} - int vnc_display_password(DisplayState *ds, const char *password) { VncDisplay *vs = vnc_display; @@ -3062,7 +3032,7 @@ void vnc_display_open(DisplayState *ds, const char *display, Error **errp) error_setg(errp, "VNC display not active"); return; } - vnc_display_close(ds); + if (strcmp(display, "none") == 0) return; -- 1.7.12.4