From: Jérémie Galarneau Date: Wed, 9 Nov 2016 19:17:30 +0000 (-0500) Subject: Validate notification type before casting X-Git-Tag: v2.0.0-pre1~729 X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=08bfb6709dd6612a377c29bbe14e6e9bc12947f4;hp=5ed148bee3a98234ee952984e56b4e1b6791c1cf;p=babeltrace.git Validate notification type before casting Signed-off-by: Jérémie Galarneau --- diff --git a/lib/plugin-system/notification/event.c b/lib/plugin-system/notification/event.c index 9163cb0c..9d99a0d6 100644 --- a/lib/plugin-system/notification/event.c +++ b/lib/plugin-system/notification/event.c @@ -58,9 +58,16 @@ error: struct bt_ctf_event *bt_notification_event_get_event( struct bt_notification *notification) { + struct bt_ctf_event *event = NULL; struct bt_notification_event *event_notification; + if (bt_notification_get_type(notification) != + BT_NOTIFICATION_TYPE_EVENT) { + goto end; + } event_notification = container_of(notification, struct bt_notification_event, parent); - return bt_get(event_notification->event); + event = bt_get(event_notification->event); +end: + return event; }