[Spice-devel] [spice-gtk] Really fix SndCodec leaks in handle_{playback, record}_start
Marc-André Lureau
mlureau at redhat.com
Wed Nov 19 02:56:36 PST 2014
ack
----- Original Message -----
> The leak fix from commit 6729c341120f was actually not doing anything at
> all as it was setting c->codec to NULL before trying to free it. It was
> also not fixing the exact same leak in the record channel.
> This commit addresses these 2 issues.
> ---
> gtk/channel-playback.c | 3 +--
> gtk/channel-record.c | 2 +-
> 2 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/gtk/channel-playback.c b/gtk/channel-playback.c
> index 40e01ba..ae8a75d 100644
> --- a/gtk/channel-playback.c
> +++ b/gtk/channel-playback.c
> @@ -372,10 +372,9 @@ static void playback_handle_start(SpiceChannel *channel,
> SpiceMsgIn *in)
> c->last_time = start->time;
> c->is_active = TRUE;
> c->min_latency = SPICE_PLAYBACK_DEFAULT_LATENCY_MS;
> - c->codec = NULL;
> + snd_codec_destroy(&c->codec);
>
> if (c->mode != SPICE_AUDIO_DATA_MODE_RAW) {
> - snd_codec_destroy(&c->codec);
> if (snd_codec_create(&c->codec, c->mode, start->frequency,
> SND_CODEC_DECODE) != SND_CODEC_OK) {
> g_warning("create decoder failed");
> return;
> diff --git a/gtk/channel-record.c b/gtk/channel-record.c
> index 946d66f..ac71999 100644
> --- a/gtk/channel-record.c
> +++ b/gtk/channel-record.c
> @@ -406,7 +406,7 @@ static void record_handle_start(SpiceChannel *channel,
> SpiceMsgIn *in)
>
> g_return_if_fail(start->format == SPICE_AUDIO_FMT_S16);
>
> - c->codec = NULL;
> + snd_codec_destroy(&c->codec);
>
> if (c->mode != SPICE_AUDIO_DATA_MODE_RAW) {
> if (snd_codec_create(&c->codec, c->mode, start->frequency,
> SND_CODEC_ENCODE) != SND_CODEC_OK) {
> --
> 2.1.0
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
More information about the Spice-devel
mailing list