void vnc_disconnect_finish(VncState *vs)

{

    int i;



    vnc_jobs_join(vs); /* Wait encoding jobs */



    vnc_lock_output(vs);

    vnc_qmp_event(vs, QAPI_EVENT_VNC_DISCONNECTED);



    buffer_free(&vs->input);

    buffer_free(&vs->output);

#ifdef CONFIG_VNC_WS

    buffer_free(&vs->ws_input);

    buffer_free(&vs->ws_output);

#endif /* CONFIG_VNC_WS */



    qapi_free_VncClientInfo(vs->info);



    vnc_zlib_clear(vs);

    vnc_tight_clear(vs);

    vnc_zrle_clear(vs);



#ifdef CONFIG_VNC_TLS

    vnc_tls_client_cleanup(vs);

#endif /* CONFIG_VNC_TLS */

#ifdef CONFIG_VNC_SASL

    vnc_sasl_client_cleanup(vs);

#endif /* CONFIG_VNC_SASL */

    audio_del(vs);

    vnc_release_modifiers(vs);



    if (vs->initialized) {

        QTAILQ_REMOVE(&vs->vd->clients, vs, next);

        qemu_remove_mouse_mode_change_notifier(&vs->mouse_mode_notifier);

    }



    if (vs->vd->lock_key_sync)

        qemu_remove_led_event_handler(vs->led);

    vnc_unlock_output(vs);



    qemu_mutex_destroy(&vs->output_mutex);

    if (vs->bh != NULL) {

        qemu_bh_delete(vs->bh);

    }

    buffer_free(&vs->jobs_buffer);



    for (i = 0; i < VNC_STAT_ROWS; ++i) {

        g_free(vs->lossy_rect[i]);

    }

    g_free(vs->lossy_rect);

    g_free(vs);

}

void vnc_disconnect_finish(VncState *vs)

{

    int i;



    vnc_jobs_join(vs); 



    vnc_lock_output(vs);

    vnc_qmp_event(vs, QAPI_EVENT_VNC_DISCONNECTED);



    buffer_free(&vs->input);

    buffer_free(&vs->output);

#ifdef CONFIG_VNC_WS

    buffer_free(&vs->ws_input);

    buffer_free(&vs->ws_output);

#endif 



    qapi_free_VncClientInfo(vs->info);



    vnc_zlib_clear(vs);

    vnc_tight_clear(vs);

    vnc_zrle_clear(vs);



#ifdef CONFIG_VNC_TLS

    vnc_tls_client_cleanup(vs);

#endif 

#ifdef CONFIG_VNC_SASL

    vnc_sasl_client_cleanup(vs);

#endif 

    audio_del(vs);

    vnc_release_modifiers(vs);



    if (vs->initialized) {

        QTAILQ_REMOVE(&vs->vd->clients, vs, next);

        qemu_remove_mouse_mode_change_notifier(&vs->mouse_mode_notifier);

    }



    if (vs->vd->lock_key_sync)

        qemu_remove_led_event_handler(vs->led);

    vnc_unlock_output(vs);



    qemu_mutex_destroy(&vs->output_mutex);

    if (vs->bh != NULL) {

        qemu_bh_delete(vs->bh);

    }

    buffer_free(&vs->jobs_buffer);



    for (i = 0; i < VNC_STAT_ROWS; ++i) {

        g_free(vs->lossy_rect[i]);

    }

    g_free(vs->lossy_rect);

    g_free(vs);

}

void FUNC_0(VncState *VAR_0)

{

    int VAR_1;



    vnc_jobs_join(VAR_0); 



    vnc_lock_output(VAR_0);

    vnc_qmp_event(VAR_0, QAPI_EVENT_VNC_DISCONNECTED);



    buffer_free(&VAR_0->input);

    buffer_free(&VAR_0->output);

#ifdef CONFIG_VNC_WS

    buffer_free(&VAR_0->ws_input);

    buffer_free(&VAR_0->ws_output);

#endif 



    qapi_free_VncClientInfo(VAR_0->info);



    vnc_zlib_clear(VAR_0);

    vnc_tight_clear(VAR_0);

    vnc_zrle_clear(VAR_0);



#ifdef CONFIG_VNC_TLS

    vnc_tls_client_cleanup(VAR_0);

#endif 

#ifdef CONFIG_VNC_SASL

    vnc_sasl_client_cleanup(VAR_0);

#endif 

    audio_del(VAR_0);

    vnc_release_modifiers(VAR_0);



    if (VAR_0->initialized) {

        QTAILQ_REMOVE(&VAR_0->vd->clients, VAR_0, next);

        qemu_remove_mouse_mode_change_notifier(&VAR_0->mouse_mode_notifier);

    }



    if (VAR_0->vd->lock_key_sync)

        qemu_remove_led_event_handler(VAR_0->led);

    vnc_unlock_output(VAR_0);



    qemu_mutex_destroy(&VAR_0->output_mutex);

    if (VAR_0->bh != NULL) {

        qemu_bh_delete(VAR_0->bh);

    }

    buffer_free(&VAR_0->jobs_buffer);



    for (VAR_1 = 0; VAR_1 < VNC_STAT_ROWS; ++VAR_1) {

        g_free(VAR_0->lossy_rect[VAR_1]);

    }

    g_free(VAR_0->lossy_rect);

    g_free(VAR_0);

}

void FUNC_0(VncState *VAR_0)
{ int VAR_1; vnc_jobs_join(VAR_0); vnc_lock_output(VAR_0); vnc_qmp_event(VAR_0, QAPI_EVENT_VNC_DISCONNECTED); buffer_free(&VAR_0->input); buffer_free(&VAR_0->output); #ifdef CONFIG_VNC_WS
buffer_free(&VAR_0->ws_input); buffer_free(&VAR_0->ws_output); #endif
qapi_free_VncClientInfo(VAR_0->info); vnc_zlib_clear(VAR_0); vnc_tight_clear(VAR_0); vnc_zrle_clear(VAR_0); #ifdef CONFIG_VNC_TLS
vnc_tls_client_cleanup(VAR_0); #endif
#ifdef CONFIG_VNC_SASL
vnc_sasl_client_cleanup(VAR_0); #endif
audio_del(VAR_0); vnc_release_modifiers(VAR_0); if (VAR_0->initialized) { QTAILQ_REMOVE(&VAR_0->vd->clients, VAR_0, next); qemu_remove_mouse_mode_change_notifier(&VAR_0->mouse_mode_notifier); } if (VAR_0->vd->lock_key_sync)
qemu_remove_led_event_handler(VAR_0->led); vnc_unlock_output(VAR_0); qemu_mutex_destroy(&VAR_0->output_mutex); if (VAR_0->bh != NULL) { qemu_bh_delete(VAR_0->bh); } buffer_free(&VAR_0->jobs_buffer); for (VAR_1 = 0; VAR_1 < VNC_STAT_ROWS; ++VAR_1) { g_free(VAR_0->lossy_rect[VAR_1]); } g_free(VAR_0->lossy_rect); g_free(VAR_0); }