X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lib%2Fplugin-system%2Fsink.c;fp=lib%2Fplugin-system%2Fsink.c;h=f49f93cce36a5399669a1ad0f28d1228bc0b2fb7;hb=4f0a761c27e537b7729430a7e59743676ed99bc7;hp=0ee51604ee1e9728769637853feed20c151d9fda;hpb=d631a9e735380820364ff373f2d40eb12feac19c;p=babeltrace.git diff --git a/lib/plugin-system/sink.c b/lib/plugin-system/sink.c index 0ee51604..f49f93cc 100644 --- a/lib/plugin-system/sink.c +++ b/lib/plugin-system/sink.c @@ -39,6 +39,21 @@ enum bt_component_status bt_component_sink_validate( enum bt_component_status ret = BT_COMPONENT_STATUS_OK; struct bt_component_sink *sink; + if (!component) { + ret = BT_COMPONENT_STATUS_INVALID; + goto end; + } + + if (!component->class) { + ret = BT_COMPONENT_STATUS_INVALID; + goto end; + } + + if (component->class->type != BT_COMPONENT_TYPE_SINK) { + ret = BT_COMPONENT_STATUS_INVALID; + goto end; + } + sink = container_of(component, struct bt_component_sink, parent); if (!sink->consume) { printf_error("Invalid sink component; no notification consumption callback defined.");