X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lib%2Fplugin-system%2Fcomponent.c;h=ec9390793b3407a1bc818905c7bda7f71dce5436;hb=528debdf7f5593bfb1abddac48554fc635d26a6d;hp=e722089ef58c7f5e0bc1792bec7c5efc67cc886b;hpb=5645cd954c45d26b521655bcc09d5828118470a9;p=babeltrace.git diff --git a/lib/plugin-system/component.c b/lib/plugin-system/component.c index e722089e..ec939079 100644 --- a/lib/plugin-system/component.c +++ b/lib/plugin-system/component.c @@ -41,6 +41,7 @@ struct bt_component * (* const component_create_funcs[])( struct bt_component_class *, struct bt_value *) = { [BT_COMPONENT_TYPE_SOURCE] = bt_component_source_create, [BT_COMPONENT_TYPE_SINK] = bt_component_sink_create, + [BT_COMPONENT_TYPE_FILTER] = bt_component_filter_create, }; static @@ -48,6 +49,7 @@ enum bt_component_status (* const component_validation_funcs[])( struct bt_component *) = { [BT_COMPONENT_TYPE_SOURCE] = bt_component_source_validate, [BT_COMPONENT_TYPE_SINK] = bt_component_sink_validate, + [BT_COMPONENT_TYPE_FILTER] = bt_component_filter_validate, }; static @@ -185,8 +187,7 @@ struct bt_component *bt_component_create( type = bt_component_class_get_type(component_class); if (type <= BT_COMPONENT_TYPE_UNKNOWN || - type >= BT_COMPONENT_TYPE_FILTER) { - /* Filter components are not supported yet. */ + type > BT_COMPONENT_TYPE_FILTER) { goto end; } @@ -203,8 +204,12 @@ struct bt_component *bt_component_create( } component->initializing = true; - component_class->init(component, params); + ret = component_class->init(component, params); component->initializing = false; + if (ret != BT_COMPONENT_STATUS_OK) { + BT_PUT(component); + goto end; + } ret = component_validation_funcs[type](component); if (ret != BT_COMPONENT_STATUS_OK) { BT_PUT(component);