int guac_rdp_client_free_handler(guac_client* client) { guac_rdp_client* rdp_client = (guac_rdp_client*) client->data; /* Wait for client thread */ pthread_join(rdp_client->client_thread, NULL); /* Free parsed settings */ if (rdp_client->settings != NULL) guac_rdp_settings_free(rdp_client->settings); /* Free display update module */ guac_rdp_disp_free(rdp_client->disp); /* Clean up filesystem, if allocated */ if (rdp_client->filesystem != NULL) guac_rdp_fs_free(rdp_client->filesystem); #ifdef ENABLE_COMMON_SSH /* Free SFTP filesystem, if loaded */ if (rdp_client->sftp_filesystem) guac_common_ssh_destroy_sftp_filesystem(rdp_client->sftp_filesystem); /* Free SFTP session */ if (rdp_client->sftp_session) guac_common_ssh_destroy_session(rdp_client->sftp_session); /* Free SFTP user */ if (rdp_client->sftp_user) guac_common_ssh_destroy_user(rdp_client->sftp_user); guac_common_ssh_uninit(); #endif /* Clean up recording, if in progress */ if (rdp_client->recording != NULL) guac_common_recording_free(rdp_client->recording); /* Clean up audio stream, if allocated */ if (rdp_client->audio != NULL) guac_audio_stream_free(rdp_client->audio); /* Clean up audio input buffer, if allocated */ if (rdp_client->audio_input != NULL) guac_rdp_audio_buffer_free(rdp_client->audio_input); /* Free client data */ guac_common_clipboard_free(rdp_client->clipboard); free(rdp_client); return 0; }
int guac_rdp_user_leave_handler(guac_user* user) { guac_rdp_client* rdp_client = (guac_rdp_client*) user->client->data; /* Update shared cursor state */ guac_common_cursor_remove_user(rdp_client->display->cursor, user); /* Free settings if not owner (owner settings will be freed with client) */ if (!user->owner) { guac_rdp_settings* settings = (guac_rdp_settings*) user->data; guac_rdp_settings_free(settings); } return 0; }