Additional check added to bt_component_sink_validate
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 11 Dec 2016 09:00:51 +0000 (04:00 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 27 May 2017 18:09:08 +0000 (14:09 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
lib/plugin-system/sink.c

index 0ee51604ee1e9728769637853feed20c151d9fda..f49f93cce36a5399669a1ad0f28d1228bc0b2fb7 100644 (file)
@@ -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.");
This page took 0.025689 seconds and 4 git commands to generate.