+2008-04-23 Sebastian Dröge <slomo@circular-chaos.org>
+
+ * gst/gstelementfactory.c: (gst_element_factory_make):
+ Unref the factory after it was used the last time, not before.
+
+ * gst/gstindexfactory.c: (gst_index_factory_make):
+ Improve debugging a bit and don't leak a ref to the index factory with
+ each call.
+
2008-04-23 Stefan Kost <ensonic@users.sf.net>
* gst/gstregistry.c:
GST_LOG_OBJECT (factory, "found factory %p", factory);
element = gst_element_factory_create (factory, name);
- gst_object_unref (factory);
if (element == NULL)
goto create_failed;
+ gst_object_unref (factory);
return element;
/* ERRORS */
create_failed:
{
GST_INFO_OBJECT (factory, "couldn't create instance!");
+ gst_object_unref (factory);
return NULL;
}
}
gst_index_factory_make (const gchar * name)
{
GstIndexFactory *factory;
+ GstIndex *index;
g_return_val_if_fail (name != NULL, NULL);
factory = gst_index_factory_find (name);
if (factory == NULL)
- return NULL;
+ goto no_factory;
+
+ index = gst_index_factory_create (factory);
+
+ if (index == NULL)
+ goto create_failed;
+
+ gst_object_unref (factory);
+ return index;
- return gst_index_factory_create (factory);
+ /* ERRORS */
+no_factory:
+ {
+ GST_INFO ("no such index factory \"%s\"!", name);
+ return NULL;
+ }
+create_failed:
+ {
+ GST_INFO_OBJECT (factory, "couldn't create instance!");
+ gst_object_unref (factory);
+ return NULL;
+ }
}