Adding to lists should be the last thing in the create function,
otherwise errors on error counter clear may lead to use-after-free
due to presence of freed objects in linked lists.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia6fb83cd053c2122939add6c330834199514b0e5
goto register_error;
}
- list_add(&event->priv->node, event_list_head);
- hlist_add_head(&event->priv->hlist_node, head);
-
ret = lttng_kernel_event_notifier_clear_error_counter(event);
if (ret)
goto register_error;
+
+ list_add(&event->priv->node, event_list_head);
+ hlist_add_head(&event->priv->hlist_node, head);
+
return event_notifier;
register_error: