From 4f0a761c27e537b7729430a7e59743676ed99bc7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sun, 11 Dec 2016 04:00:51 -0500 Subject: [PATCH] Additional check added to bt_component_sink_validate MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- lib/plugin-system/sink.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/plugin-system/sink.c b/lib/plugin-system/sink.c index 0ee51604e..f49f93cce 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."); -- 2.34.1