From bbc83bc91fca27cc18e48b6bdbeb2ab3aefda7e2 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Mon, 17 Jul 2017 15:36:21 -0400 Subject: [PATCH] bt_notification_event_create(): create an empty CC priority map when NULL MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- lib/graph/notification/event.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/graph/notification/event.c b/lib/graph/notification/event.c index 407961bf8..b56f556fb 100644 --- a/lib/graph/notification/event.c +++ b/lib/graph/notification/event.c @@ -174,11 +174,18 @@ struct bt_notification *bt_notification_event_create(struct bt_ctf_event *event, goto error; } - if (!cc_prio_map) { - BT_LOGW_STR("Invalid parameter: clock class priority map is NULL."); - goto error; + if (cc_prio_map) { + /* Function's reference, released at the end */ + bt_get(cc_prio_map); + } else { + cc_prio_map = bt_clock_class_priority_map_create(); + if (!cc_prio_map) { + BT_LOGE_STR("Cannot create empty clock class priority map."); + goto error; + } } + assert(cc_prio_map); event_class = bt_ctf_event_borrow_event_class(event); assert(event_class); BT_LOGD("Creating event notification object: " @@ -248,6 +255,7 @@ struct bt_notification *bt_notification_event_create(struct bt_ctf_event *event, error: bt_put(notification); + bt_put(cc_prio_map); return NULL; } -- 2.34.1