shapewipe: Unref caps and element after usage
authorSebastian Rasmussen <sebras@hotmail.com>
Fri, 8 Aug 2014 10:54:30 +0000 (12:54 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 11 Aug 2014 06:47:34 +0000 (08:47 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=734478

gst/shapewipe/gstshapewipe.c
tests/examples/shapewipe/shapewipe-example.c

index 024ef68..5d4fa94 100644 (file)
@@ -448,20 +448,20 @@ static GstCaps *
 gst_shape_wipe_mask_sink_getcaps (GstShapeWipe * self, GstPad * pad,
     GstCaps * filter)
 {
-  GstCaps *ret, *tmp;
+  GstCaps *ret, *tmp, *tcaps;
   guint i, n;
 
   if (gst_pad_has_current_caps (pad))
     return gst_pad_get_current_caps (pad);
 
+  tcaps = gst_pad_get_pad_template_caps (self->video_sinkpad);
   tmp = gst_pad_peer_query_caps (self->video_sinkpad, NULL);
   if (tmp) {
-    ret =
-        gst_caps_intersect (tmp,
-        gst_pad_get_pad_template_caps (self->video_sinkpad));
+    ret = gst_caps_intersect (tmp, tcaps);
+    gst_caps_unref (tcaps);
     gst_caps_unref (tmp);
   } else {
-    ret = gst_pad_get_pad_template_caps (self->video_sinkpad);
+    ret = tcaps;
   }
 
   GST_LOG_OBJECT (pad, "video sink accepted caps: %" GST_PTR_FORMAT, ret);
index 05ed3d9..a61926d 100644 (file)
@@ -101,6 +101,7 @@ main (gint argc, gchar ** argv)
   gst_object_add_control_binding (GST_OBJECT_CAST (shapewipe),
       gst_direct_control_binding_new (GST_OBJECT_CAST (shapewipe), "position",
           cs));
+  gst_object_unref (shapewipe);
 
   g_object_set (cs,
       "amplitude", 0.5,