- ret = -1;
- goto error_free_ht_element;
- }
-
- /* Build a list of clients to which this new trigger applies. */
- cds_lfht_for_each_entry (state->client_socket_ht, &iter, client,
- client_socket_ht_node) {
- if (!trigger_applies_to_client(trigger, client)) {
- continue;
- }
-
- client_list_element =
- zmalloc(sizeof(*client_list_element));
- if (!client_list_element) {
- ret = -1;
- goto error_put_client_list;
+ /*
+ * No client list for this condition yet. We create new
+ * one and build it up.
+ */
+ client_list = notification_client_list_create(state, condition);
+ if (!client_list) {
+ ERR("Error creating notification client list for trigger %s", trigger->name);
+ goto error_free_ht_element;