[Spice-devel] [PATCH spice-server 6/8] snd_worker: fix memory leak of PlaybackChannel
Yonit Halperin
yhalperi at redhat.com
Fri Jul 26 11:08:36 PDT 2013
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
---
server/snd_worker.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/server/snd_worker.c b/server/snd_worker.c
index d6ec47a..849f002 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);
--
1.8.1.4
More information about the Spice-devel
mailing list