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 */
guac_rdpdrPlugin* rdpdr = (guac_rdpdrPlugin*) plugin;
/* Get client from plugin */
/* Get client from plugin parameters */
guac_client* client = (guac_client*)
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 */
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) {
/* Get audio stream from plugin */
audio_stream* audio = (audio_stream*)
plugin->channel_entry_points.pExtendedData;
guac_rdpsndPlugin* rdpsnd = (guac_rdpsndPlugin*) plugin;
/* 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
/* Update every 10 ms */
@ -117,8 +123,7 @@ void guac_rdpsnd_process_receive(rdpSvcPlugin* plugin,
guac_rdpsnd_pdu_header header;
/* Get audio stream from plugin */
audio_stream* audio = (audio_stream*)
plugin->channel_entry_points.pExtendedData;
audio_stream* audio = rdpsnd->audio;
/* Read RDPSND PDU header */
Stream_Read_UINT8(input_stream, header.message_type);

View File

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