From 0a4bfc95d17338ae12e92bb6d4ef0c06b98a9872 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 17 Mar 2016 17:11:40 -0700 Subject: [PATCH] GUAC-1164: Ensure audio stream and context are freed upon disconnect. --- src/protocols/rdp/rdp.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/protocols/rdp/rdp.c b/src/protocols/rdp/rdp.c index 083ca0df..80158dbf 100644 --- a/src/protocols/rdp/rdp.c +++ b/src/protocols/rdp/rdp.c @@ -981,18 +981,27 @@ static int guac_rdp_handle_connection(guac_client* client) { pthread_mutex_lock(&(rdp_client->rdp_lock)); - /* Clean up RDP client */ + /* Disconnect client and channels */ freerdp_channels_close(channels, rdp_inst); freerdp_channels_free(channels); freerdp_disconnect(rdp_inst); + + /* Clean up RDP client context */ freerdp_clrconv_free(((rdp_freerdp_context*) rdp_inst->context)->clrconv); cache_free(rdp_inst->context->cache); + freerdp_context_free(rdp_inst); + + /* Clean up RDP client */ freerdp_free(rdp_inst); /* Clean up filesystem, if allocated */ if (rdp_client->filesystem != NULL) guac_rdp_fs_free(rdp_client->filesystem); + /* Clean up audio stream, if allocated */ + if (rdp_client->audio != NULL) + guac_audio_stream_free(rdp_client->audio); + #ifdef ENABLE_COMMON_SSH /* Free SFTP filesystem, if loaded */ if (rdp_client->sftp_filesystem)