playsink: Fix volume element leak

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
This commit is contained in:
Vineeth TM 2015-10-15 10:01:38 +09:00 committed by Sebastian Dröge
parent 4fe12c1b09
commit b424bc2e4f

View file

@ -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);
@ -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);
@ -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;
}