FreeRDP/FreeRDP — Issue #406: significant memory leak in rdpsnd
Author: dpoe
Created: 2012-02-07 23:03:51+00:00
State: open

I'm seeing a pretty big, continual growth in xfreerdp-1.0's process size when using audio redirection (rdpsnd).

In looking through the code, it appears the data_in stream passed to rdpsnd is never freed...

svc_plugin_process_received creates a stream if the dataflags say it's the first data in the channel, enlarges & copies the data to the stream, and if it's the last data in the channel, drops the pointer to the stream and passes it in a queued svc_data_in_item instead.

svc_plugin_process_data_in goes through the list of queued svc_data_in_item's and passes each one to the plugin's receive_callback. It frees the svc_data_in_item, but it never frees the data_in stream, so I guess it is expecting the plugin to do it? (And that's confirmed by rdpdr.) (Wonder what happens if receive_callback isn't connected?)

However, rdpsnd_process_receive never does a stream_free() in its input data. My guess is that "stream_free(data_in)" needs to be called at the end of rdp_process_receive and at the point it can return early (if expectingWav) -- its two return points.

I'm not an expert in freerdp plugins or in rdpsnd, so it's hard to say with 100% confidence that the above is the correct fix. But that's how it looks to me.