Do not use pExtendedData beyond connect handler. NULL out pExtendedData once done.

This commit is contained in:
Michael Jumper 2013-08-22 14:51:37 -07:00
parent f70333a65a
commit 1f0ae7b4ba
3 changed files with 20 additions and 6 deletions

View File

@ -93,10 +93,14 @@ void guac_rdpdr_process_connect(rdpSvcPlugin* plugin) {
/* Get RDPDR plugin */ /* Get RDPDR plugin */
guac_rdpdrPlugin* rdpdr = (guac_rdpdrPlugin*) plugin; guac_rdpdrPlugin* rdpdr = (guac_rdpdrPlugin*) plugin;
/* Get client from plugin */ /* Get client from plugin parameters */
guac_client* client = (guac_client*) guac_client* client = (guac_client*)
plugin->channel_entry_points.pExtendedData; plugin->channel_entry_points.pExtendedData;
/* NULL out pExtendedData so we don't lose our guac_client due to an
* automatic free() within libfreerdp */
plugin->channel_entry_points.pExtendedData = NULL;
/* Get data from client */ /* Get data from client */
rdp_guac_client_data* client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* client_data = (rdp_guac_client_data*) client->data;

View File

@ -88,9 +88,15 @@ int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints) {
void guac_rdpsnd_process_connect(rdpSvcPlugin* plugin) { void guac_rdpsnd_process_connect(rdpSvcPlugin* plugin) {
/* Get audio stream from plugin */ guac_rdpsndPlugin* rdpsnd = (guac_rdpsndPlugin*) plugin;
audio_stream* audio = (audio_stream*)
plugin->channel_entry_points.pExtendedData; /* Get audio stream from plugin parameters */
audio_stream* audio = rdpsnd->audio =
(audio_stream*) plugin->channel_entry_points.pExtendedData;
/* NULL out pExtendedData so we don't lose our audio_stream due to an
* automatic free() within libfreerdp */
plugin->channel_entry_points.pExtendedData = NULL;
#ifdef RDPSVCPLUGIN_INTERVAL_MS #ifdef RDPSVCPLUGIN_INTERVAL_MS
/* Update every 10 ms */ /* Update every 10 ms */
@ -117,8 +123,7 @@ void guac_rdpsnd_process_receive(rdpSvcPlugin* plugin,
guac_rdpsnd_pdu_header header; guac_rdpsnd_pdu_header header;
/* Get audio stream from plugin */ /* Get audio stream from plugin */
audio_stream* audio = (audio_stream*) audio_stream* audio = rdpsnd->audio;
plugin->channel_entry_points.pExtendedData;
/* Read RDPSND PDU header */ /* Read RDPSND PDU header */
Stream_Read_UINT8(input_stream, header.message_type); Stream_Read_UINT8(input_stream, header.message_type);

View File

@ -84,6 +84,11 @@ typedef struct guac_rdpsndPlugin {
*/ */
rdpSvcPlugin plugin; rdpSvcPlugin plugin;
/**
* The current audio stream.
*/
audio_stream* audio;
/** /**
* The block number of the last SNDC_WAVE (WaveInfo) PDU received. * The block number of the last SNDC_WAVE (WaveInfo) PDU received.
*/ */