typefind: don't leak the force-caps property
authorArnout Vandecappelle <arnout@mind.be>
Tue, 5 May 2009 15:41:24 +0000 (17:41 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Tue, 12 May 2009 08:21:26 +0000 (10:21 +0200)
Fixes #581321

plugins/elements/gsttypefindelement.c

index 0752451..e1beba1 100644 (file)
@@ -235,6 +235,7 @@ gst_type_find_element_class_init (GstTypeFindElementClass * typefind_class)
   gstelement_class->change_state =
       GST_DEBUG_FUNCPTR (gst_type_find_element_change_state);
 }
+
 static void
 gst_type_find_element_init (GstTypeFindElement * typefind,
     GstTypeFindElementClass * g_class)
@@ -278,6 +279,7 @@ gst_type_find_element_init (GstTypeFindElement * typefind,
 
   typefind->store = NULL;
 }
+
 static void
 gst_type_find_element_dispose (GObject * object)
 {
@@ -287,6 +289,10 @@ gst_type_find_element_dispose (GObject * object)
     gst_buffer_unref (typefind->store);
     typefind->store = NULL;
   }
+  if (typefind->force_caps) {
+    gst_caps_unref (typefind->force_caps);
+    typefind->force_caps = NULL;
+  }
 
   G_OBJECT_CLASS (parent_class)->dispose (object);
 }
@@ -318,6 +324,7 @@ gst_type_find_element_set_property (GObject * object, guint prop_id,
       break;
   }
 }
+
 static void
 gst_type_find_element_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec)
@@ -607,8 +614,8 @@ gst_type_find_element_setcaps (GstPad * pad, GstCaps * caps)
 }
 
 static GstCaps *
-gst_type_find_guess_by_extension (GstTypeFindElement *typefind, GstPad *pad,
-    GstTypeFindProbability *probability)
+gst_type_find_guess_by_extension (GstTypeFindElement * typefind, GstPad * pad,
+    GstTypeFindProbability * probability)
 {
   GstQuery *query;
   gchar *uri;
@@ -637,12 +644,14 @@ gst_type_find_guess_by_extension (GstTypeFindElement *typefind, GstPad *pad,
       break;
     find--;
   }
-  if (find < 0) 
+  if (find < 0)
     goto no_extension;
 
-  GST_DEBUG_OBJECT (typefind, "found extension %s", &uri[find+1]);
+  GST_DEBUG_OBJECT (typefind, "found extension %s", &uri[find + 1]);
 
-  caps = gst_type_find_helper_for_extension (GST_OBJECT_CAST (typefind), &uri[find+1]);
+  caps =
+      gst_type_find_helper_for_extension (GST_OBJECT_CAST (typefind),
+      &uri[find + 1]);
   if (caps)
     *probability = GST_TYPE_FIND_MAXIMUM;
 
@@ -818,7 +827,7 @@ gst_type_find_element_activate (GstPad * pad)
      3. deactivate pull mode.
      4. src pad might have been activated push by the state change. deactivate.
      5. if we didn't find any caps, try getting the uri extension by doing an uri
-        query.
+     query.
      6. if we didn't find any caps, fail.
      7. emit have-type; maybe the app connected the source pad to something.
      8. if the sink pad is activated, we are in pull mode. succeed.