gstfunnel: avoid access of freed pad
[platform/upstream/gstreamer.git] / gst / gstpluginfeature.c
index 5b86fd3..3e1228e 100644 (file)
@@ -180,6 +180,26 @@ gst_plugin_feature_get_rank (GstPluginFeature * feature)
 }
 
 /**
+ * gst_plugin_feature_get_plugin:
+ * @feature: a feature
+ *
+ * Get the plugin that provides this feature.
+ *
+ * Returns: (transfer full): the plugin that provides this feature, or %NULL.
+ *     Unref with gst_object_unref() when no longer needed.
+ */
+GstPlugin *
+gst_plugin_feature_get_plugin (GstPluginFeature * feature)
+{
+  g_return_val_if_fail (GST_IS_PLUGIN_FEATURE (feature), NULL);
+
+  if (feature->plugin == NULL)
+    return NULL;
+
+  return (GstPlugin *) gst_object_ref (feature->plugin);
+}
+
+/**
  * gst_plugin_feature_list_free:
  * @list: (transfer full) (element-type Gst.PluginFeature): list
  *     of #GstPluginFeature
@@ -221,7 +241,7 @@ gst_plugin_feature_list_copy (GList * list)
     GList *last;
 
     new_list = g_list_alloc ();
-    new_list->data = g_object_ref ((GObject *) list->data);
+    new_list->data = gst_object_ref (list->data);
     new_list->prev = NULL;
     last = new_list;
     list = list->next;
@@ -229,7 +249,7 @@ gst_plugin_feature_list_copy (GList * list)
       last->next = g_list_alloc ();
       last->next->prev = last;
       last = last->next;
-      last->data = g_object_ref ((GObject *) list->data);
+      last->data = gst_object_ref (list->data);
       list = list->next;
     }
     last->next = NULL;