Skip to content

Commit

Permalink
playsink: Fix volume element leak
Browse files Browse the repository at this point in the history
In case sink implements a streamvolume interface, volume element is being got
from the sink. But this is transfer full. So the memory should be freed before
setting it to NULL. This was resulting in major memory leaks

https://bugzilla.gnome.org/show_bug.cgi?id=755867
  • Loading branch information
Vineeth TM authored and sdroege committed Oct 17, 2015
1 parent 18abd02 commit b33bb85
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gst/playback/gstplaysink.c
Expand Up @@ -3472,6 +3472,8 @@ gst_play_sink_do_reconfigure (GstPlaySink * playsink)

activate_chain (GST_PLAY_CHAIN (playsink->audiochain), FALSE);
disconnect_audio_chain (playsink->audiochain, playsink);
if (playsink->audiochain->volume)
gst_object_unref (playsink->audiochain->volume);
playsink->audiochain->volume = NULL;
if (playsink->audiochain->ts_offset)
gst_object_unref (playsink->audiochain->ts_offset);
Expand Down Expand Up @@ -3580,6 +3582,8 @@ gst_play_sink_do_reconfigure (GstPlaySink * playsink)

if (playsink->audiochain->sink_volume) {
disconnect_audio_chain (playsink->audiochain, playsink);
if (playsink->audiochain->volume)
gst_object_unref (playsink->audiochain->volume);
playsink->audiochain->volume = NULL;
if (playsink->audiochain->ts_offset)
gst_object_unref (playsink->audiochain->ts_offset);
Expand Down Expand Up @@ -4786,6 +4790,8 @@ gst_play_sink_change_state (GstElement * element, GstStateChange transition)
/* remove our links to the volume elements when they were
* provided by a sink */
disconnect_audio_chain (playsink->audiochain, playsink);
if (playsink->audiochain->volume)
gst_object_unref (playsink->audiochain->volume);
playsink->audiochain->volume = NULL;
}

Expand Down

0 comments on commit b33bb85

Please sign in to comment.