audiovisualizer: fix caps leaks

Fix leak of caps event and of caps objects when setting caps on
sink and src pads
This commit is contained in:
Thiago Santos 2014-06-27 17:27:25 -03:00
parent cf76aa2a1d
commit c5ef1bee73

View file

@ -766,12 +766,14 @@ gst_audio_visualizer_src_setcaps (GstAudioVisualizer * scope, GstCaps * caps)
/* find a pool for the negotiated caps now */ /* find a pool for the negotiated caps now */
res = gst_audio_visualizer_do_bufferpool (scope, caps); res = gst_audio_visualizer_do_bufferpool (scope, caps);
gst_caps_unref (caps);
return res; return res;
/* ERRORS */ /* ERRORS */
wrong_caps: wrong_caps:
{ {
gst_caps_unref (caps);
GST_DEBUG_OBJECT (scope, "error parsing caps"); GST_DEBUG_OBJECT (scope, "error parsing caps");
return FALSE; return FALSE;
} }
@ -1263,6 +1265,7 @@ gst_audio_visualizer_sink_event (GstPad * pad, GstObject * parent,
gst_event_parse_caps (event, &caps); gst_event_parse_caps (event, &caps);
res = gst_audio_visualizer_sink_setcaps (scope, caps); res = gst_audio_visualizer_sink_setcaps (scope, caps);
gst_event_unref (event);
break; break;
} }
case GST_EVENT_FLUSH_START: case GST_EVENT_FLUSH_START: