visual: fix caps leak
authorLuis de Bethencourt <luis.bg@samsung.com>
Wed, 21 Jan 2015 15:22:15 +0000 (15:22 +0000)
committerLuis de Bethencourt <luis.bg@samsung.com>
Wed, 21 Jan 2015 15:22:15 +0000 (15:22 +0000)
Fix leak of caps event and of caps objects when setting caps on sink and src
pads. Sync audiovisualizer class implementation to the one in gst-plugins-bad.
This commit matches c5ef1bee7318f057aa1f542d5a1474b75e85131a in that module.

https://bugzilla.gnome.org/show_bug.cgi?id=742875

ext/libvisual/gstaudiovisualizer.c

index 1273ae8..4bc51b3 100644 (file)
@@ -768,12 +768,14 @@ gst_audio_visualizer_src_setcaps (GstAudioVisualizer * scope, GstCaps * caps)
 
   /* find a pool for the negotiated caps now */
   res = gst_audio_visualizer_do_bufferpool (scope, caps);
+  gst_caps_unref (caps);
 
   return res;
 
   /* ERRORS */
 wrong_caps:
   {
+    gst_caps_unref (caps);
     GST_DEBUG_OBJECT (scope, "error parsing caps");
     return FALSE;
   }
@@ -1292,6 +1294,7 @@ gst_audio_visualizer_sink_event (GstPad * pad, GstObject * parent,
 
       gst_event_parse_caps (event, &caps);
       res = gst_audio_visualizer_sink_setcaps (scope, caps);
+      gst_event_unref (event);
       break;
     }
     case GST_EVENT_FLUSH_STOP: