diff options
author | Yonit Halperin <yhalperi@redhat.com> | 2013-07-25 14:49:33 -0400 |
---|---|---|
committer | Yonit Halperin <yhalperi@redhat.com> | 2013-07-29 11:35:17 -0400 |
commit | 134b7f310de5120b233670d18641d32204f31318 (patch) | |
tree | 03a73f92bae8d652912712a65cd49b0f1a9a2a66 /server/snd_worker.c | |
parent | 46c2ce8f1af0170a2c6a335cc743a3ddff2d96d0 (diff) | |
download | spice-134b7f310de5120b233670d18641d32204f31318.tar.gz spice-134b7f310de5120b233670d18641d32204f31318.tar.xz spice-134b7f310de5120b233670d18641d32204f31318.zip |
snd_worker: fix memory leak of PlaybackChannel
When the sequence of calls bellow occurs, the PlaybackChannel
is not released (snd_channel_put is not called for the
samples that refer to the channel).
spice_server_playback_get_buffer
snd_channel_disconnect
spice_server_playback_put_samples
Diffstat (limited to 'server/snd_worker.c')
-rw-r--r-- | server/snd_worker.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/server/snd_worker.c b/server/snd_worker.c index d6ec47a8..849f0026 100644 --- a/server/snd_worker.c +++ b/server/snd_worker.c @@ -1097,14 +1097,13 @@ SPICE_GNUC_VISIBLE void spice_server_playback_put_samples(SpicePlaybackInstance PlaybackChannel *playback_channel; AudioFrame *frame; - if (!sin->st->worker.connection) { - return; - } - frame = SPICE_CONTAINEROF(samples, AudioFrame, samples); playback_channel = frame->channel; - if (!snd_channel_put(&playback_channel->base) || !playback_channel->base.worker->connection) { + spice_assert(playback_channel); + if (!snd_channel_put(&playback_channel->base) || + sin->st->worker.connection != &playback_channel->base) { /* lost last reference, channel has been destroyed previously */ + spice_info("audio samples belong to a disconnected channel"); return; } spice_assert(playback_channel->base.active); |